To confirm that this was not something special triggered by the DB2 driver, I ran the same test program loading the Derby Network client, MySQL and PostgreSQL JDBC drivers. With derby.jar in the class path the embedded driver and engine are loaded in all cases.

Regards,
Olav


Olav Sandstaa wrote:
The following program if run with jdk 1.6 and derby.jar in the class path will load the embedded Derby driver and engine as well as the DB2 driver:

class AutoLoad {

   public static void main(String[] args) {
       try {
           Class.forName("com.ibm.db2.jcc.DB2Driver");
       } catch (ClassNotFoundException e) {
           System.out.println("FAIL: Failed to load driver: " + e);
       }
   }
}

The call stack when the Embedded driver is loaded looks like this:

at org.apache.derby.jdbc.EmbeddedDriver.<init>(EmbeddedDriver.java:102) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:506)
       at java.lang.Class.newInstance0(Class.java:355)
       at java.lang.Class.newInstance(Class.java:308)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345)
       at java.util.ServiceLoader$1.next(ServiceLoader.java:421)
       at java.sql.DriverService.run(DriverManager.java:622)
       at java.security.AccessController.doPrivileged(Native Method)
at java.sql.DriverManager.loadInitialDrivers(DriverManager.java:477)
       at java.sql.DriverManager.initialize(DriverManager.java:578)
       at java.sql.DriverManager.registerDriver(DriverManager.java:268)
       at com.ibm.db2.jcc.DB2Driver.<clinit>(DB2Driver.java:46)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:169)
       at AutoLoad.main(AutoLoad.java:8)

AutoMagic :-)

..olav

Reply via email to