ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <>
Subject RE: AntClassLoader and JDBC drivers
Date Tue, 15 Aug 2000 23:20:25 GMT

> Turns out loadClass is not guaranted to run static initialisers so your
> supposed to use Class.forName which is but that's no use if you
> want to load
> something via a ClassLoader. I can get them to run by creating
> and instance
> of the class, but that's a hack as java.sql.Driver is an interface so
> there's no guarantee the an empty constructor will work.

The driver you are actually loading is a class which implements the Driver
interface, so there should be no problem in loading it and creating an
instance. This is true of the Oracle driver we use here. Creating an
instance should run the static initializer and cause the class to register
itself with the DriverManager (loaded in the system class loader).

Can you try that?

View raw message