org.ckkloverdos.db
Class DbUtil

java.lang.Object
  extended by org.ckkloverdos.db.DbUtil

public final class DbUtil
extends java.lang.Object

DB-related utility methods.

Author:
Christos KK Loverdos

Method Summary
static java.sql.Driver registerDriver(java.lang.String className)
          Registers the JDBC driver implemented by the class having the provided className.
static java.sql.Driver registerDriver(java.lang.String className, java.lang.ClassLoader cl)
          Registers the JDBC driver implemented by the class having the provided className.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

registerDriver

public static java.sql.Driver registerDriver(java.lang.String className)
                                      throws java.sql.SQLException
Registers the JDBC driver implemented by the class having the provided className. The context class loader is used to load the class.

Parameters:
className -
Throws:
java.sql.SQLException
See Also:
registerDriver(String, ClassLoader)

registerDriver

public static java.sql.Driver registerDriver(java.lang.String className,
                                             java.lang.ClassLoader cl)
                                      throws java.sql.SQLException
Registers the JDBC driver implemented by the class having the provided className. The provided class loader is used to load the class.

Note that according to the Javadocs, in order for the driver to be accessible by DriverManager, the same class loader as the one that loaded the application/applet is used. This causes problems in the case we have dynamically loaded our driver by using, for instance, a CompositeClassLoader. In order to overcome the inconvenience, the implementation of this method uses dynamic proxies.

Parameters:
className -
cl -
Throws:
java.sql.SQLException
See Also:
DriverInvocationHandler


Copyright © 1999-2007 Christos KK Loverdos. All Rights Reserved.