On Oct 16, 2008, at 11:18 PM, Luc Prefontaine wrote:
> Looking at classForName in the RT.java module (in trunk, checked out
> a few days ago):
>
> static public Class classForName(String name) throws
> ClassNotFoundException{
>
> return Class.forName(name, false, baseLoader());
> }
>
Yep, Class/forName does the job.
I like the consistency of the JVM implementations (glup !), I run on
Ubuntu wih:
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)
I do have the mysql jar file in my classpath
Hi,
Am 17.10.2008 um 03:12 schrieb Luc Prefontaine:
> This means that (clojure.lang.RT/classForName
> "com.mysql.jdbc.Driver") has no effect on the static code in the
> class.
You're right, RT/classForName doesn't do initialization.
Does this work for you?:
(Class/forName "com.mysql.jdbc
On Oct 16, 2008, at 9:12 PM, Luc Prefontaine wrote:
> Ouf ! I'm not insane, (at least regarding this bug :)))
> This means that (clojure.lang.RT/classForName
> "com.mysql.jdbc.Driver") has no effect on the static code in the
> class.
> This is done in the sql contrib library but it has no e
I see the same problem trying to connect using the mysql driver. I
wonder if it might be a classloader issue.
Bill
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email
Ouf ! I'm not insane, (at least regarding this bug :)))
I just realized that when I explicitly register the driver, there are
now two instances begin added:
Clojure
user=> (println (enumeration-seq (. java.sql.DriverManager getDrivers)))
([EMAIL PROTECTED]) ;; No instance registered
nil
user=> (c
The SQL library in clojure-contrib already does this just for that sole
purpose:
(defmacro with-connection
"Evaluates body in the context of a new connection to a database then
closes it. db-spec is a map containing string values for these
required
keys:
:classname the jdbc driver cl
> Rich, I may be old school (surely just because of my age) but would it
> be possible some day to create a cook book in PDF ?
FYI Hans uploaded a manual.pdf to the files section of this group,
which is great. Thanks Hans. Very useful.
See original post
http://groups.google.com/group/clojure/bro
On Fri, Oct 10, 2008 at 11:45 AM, mritun <[EMAIL PROTECTED]> wrote:
>
> On Oct 10, 1:46 am, Luc Prefontaine <[EMAIL PROTECTED]>
> wrote:
[...]
>> The mysql jdbc driver code says that it registers itself (static block)
>> but something is wrong.
>> Eventually I will find why but now I have other pr
On Oct 10, 1:46 am, Luc Prefontaine <[EMAIL PROTECTED]>
wrote:
> I found a workaround...
>
> I was able to register the driver using
> -Djdbc.drivers=com.mysql.jdbc.Driver on the java command line.
> Looks like loading the class is not enough, adding the above does work:
>
> user=> (enumeration-
Oups... I knew I was making some stupid mistake here...
I need to do this instead:
user=> (enumeration-seq (. java.sql.DriverManager getDrivers))
([EMAIL PROTECTED])
user=> (java.sql.DriverManager/registerDriver (new
com.mysql.jdbc.Driver))
nil
user=> (enumeration-seq (. java.sql.DriverManager
ge
> The following fails:
>
> user=> (cast java.sql.Driver (clojure.lang.RT/classForName
> "com.mysql.jdbc.Driver"))
> java.lang.ClassCastException (NO_SOURCE_FILE:0)
>
> The com.mysql.jdbc.Drive does implement the java.sql.Driver interface:
>
> user=> (bases (clojure.lang.RT/classForName "com.mysq
I found a workaround...
I was able to register the driver using
-Djdbc.drivers=com.mysql.jdbc.Driver on the java command line.
Looks like loading the class is not enough, adding the above does work:
user=> (enumeration-seq (. java.sql.DriverManager getDrivers))
([EMAIL PROTECTED] [EMAIL PROTECTED
Hi Luc,
You are trying to use a class where an instance of the class is
expected. You will need to .newInstance or equivalent.
Stuart
> Hi everyone,
>
> I may look stupid but how do you cast Java arguments ?
>
> (java.sql.DriverManager/registerDriver (clojure.lang.RT/classForName
> "com.mys
On Oct 9, 2008, at 12:06 PM, Luc Prefontaine wrote:
> Hi everyone,
>
> I may look stupid but how do you cast Java arguments ?
>
> (java.sql.DriverManager/registerDriver (clojure.lang.RT/classForName
> "com.mysql.jdbc.Driver"))
> java.lang.ClassCastException: java.lang.Class cannot be cast to
On Thu, Oct 9, 2008 at 12:06 PM, Luc Prefontaine
<[EMAIL PROTECTED]> wrote:
>
> I may look stupid but how do you cast Java arguments ?
user=> (doc cast)
-
clojure/cast
([c x])
Throws a ClassCastException if x is not a c, else returns x.
nil
So, (cast java.sql.Driver you
Hi everyone,
I may look stupid but how do you cast Java arguments ?
(java.sql.DriverManager/registerDriver (clojure.lang.RT/classForName
"com.mysql.jdbc.Driver"))
java.lang.ClassCastException: java.lang.Class cannot be cast to
java.sql.Driver (NO_SOURCE_FILE:0)
I fully agree with the error mes
17 matches
Mail list logo