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-seq (. java.sql.DriverManager getDrivers))
> ([EMAIL PROTECTED] [EMAIL PROTECTED])
>
> 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 pressing needs to full
> fill than debugging that code.
Static blocks don't execute until the class is loaded, so just
specifying a class in classpath is not enough.
In Java the idiomatic way to let the driver initialize itself, is to
add the following line somewhere in your initialization code before
requesting connection:
Class.forName("com.mysql.jdbc.Driver");
This loads the class, and its static block registers the driver. You'd
have to do an equivalent in clojure too.
- Akhilesh
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---