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 getDrivers)) ([EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]) user=> I read the java.sql.DriverManager javadoc a bit too fast. It wants an instance of the Driver class, not the class itself. Still no idea why the static code does not register the driver: static { try { java.sql.DriverManager.registerDriver(new Driver()); } catch (SQLException E) { throw new RuntimeException("Can't register driver!"); } } but that's minor for now. It loads fine with this patch. Thank you all, Luc On Thu, 2008-10-09 at 16:54 -0400, J. McConnell wrote: > > 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.mysql.jdbc.Driver")) > > (com.mysql.jdbc.NonRegisteringDriver java.sql.Driver) > > > > Is my syntax right ? > > Your syntax is right, but you aren't casting the right thing here. > (clojure.lang.RT/classForName "com.mysql.jdbc.Driver") does not return > a com.mysql.jdbc.Driver, it returns a Class<com.mysql.jdbc.Driver>. > I.e., it is an instance of Class, not of java.sql.Driver. > > As for how to get something valid to pass into registerDriver, I don't > know off-hand. You need to get a valid instance of > com.mysql.jdbc.Driver. You'll have to check the docs for that Driver, > I guess. > > HTH, > > - J. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---