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=
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
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
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());
}
false
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
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
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 pressing needs
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
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