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 effect on the  
> list of registered drivers.

Nicely done! Thanks for narrowing that down.

Here's what I found on Mac OS X (10.5.5):

With Java 6, if the driver jar is in my classpath when Clojure starts  
up, it's always listed in the response from getDrivers. This is true  
whether I give the jar as an entry to "-cp" or if the jar is in a  
directory in my java.ext.dirs list.

With Java 5, "clojure.lang.RT/classForName" will return the class, but  
the response form getDrivers does not show the class as registered.   
However, Class/forName will return the class and cause it to be  
registered with the DriverManager.

        java version 1.5.0_16
        Clojure
        user=> (enumeration-seq (java.sql.DriverManager/getDrivers))
        nil
        user=> (clojure.lang.RT/classForName "com.mysql.jdbc.Driver")
        #=com.mysql.jdbc.Driver
        user=> (enumeration-seq (java.sql.DriverManager/getDrivers))
        nil
        user=> (Class/forName "com.mysql.jdbc.Driver")
        #=com.mysql.jdbc.Driver
        user=> (enumeration-seq (java.sql.DriverManager/getDrivers))
        (#=(com.mysql.jdbc.Driver. "[EMAIL PROTECTED]"))
        user=>

I'll change clojure.contrib.sql to use Class/forName pending a  
possible change in the behavior of clojure.lang.RT/classForName in  
this regard.

Please let me know if that fixes things in your environment as well.

--Steve


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to