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=> (clojure.lang.RT/classForName "com.mysql.jdbc.Driver")
com.mysql.jdbc.Driver
user=> (println (enumeration-seq (. java.sql.DriverManager getDrivers)))
([EMAIL PROTECTED]) ;; Still no instances registered
nil
user=> (java.sql.DriverManager/registerDriver (new
com.mysql.jdbc.Driver))
nil
user=> (println (enumeration-seq (. java.sql.DriverManager getDrivers)))
([EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED]) ;; Two instances registered
nil
user=> 

I suspect the static class code to be executed when I register the
driver on top of the registration itself:

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.

However:

Clojure
user=> (println (enumeration-seq (. java.sql.DriverManager getDrivers)))
([EMAIL PROTECTED])
nil
user=> (new com.mysql.jdbc.Driver)
[EMAIL PROTECTED]
user=> (println (enumeration-seq (. java.sql.DriverManager getDrivers)))
([EMAIL PROTECTED] [EMAIL PROTECTED]) ;;
Ah ! Ah !
nil
user=> 

does the job.

Static code in the class is not executed by calling Class.classForName.

I run java 6:



On Thu, 2008-10-16 at 16:55 -0700, .Bill Smith wrote:

> 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 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