|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.cjdbc.controller.connection.DriverManager
This class defines a DriverManager. In contrast to java.sql.DriverManager this class allows to use Drivers with the same name but with different versions, if no drivername is used it is a wrapper around java.sql.DriverManager.
Field Summary | |
private static java.util.Set |
defaultDrivers
Driver class names read from default drivers, without driverPath |
(package private) static Trace |
logger
Logger instance. |
private static java.util.Map |
namedDrivers
We keep a reference to already loaded named drivers. |
Constructor Summary | |
DriverManager()
|
Method Summary | |
static java.io.File |
convertToAbsolutePath(java.lang.String pathName)
convert a path into an absolute path if the path is already an absolute path, it is just returned otherwise a relative path is considered to be relative to the drivers directory |
static java.sql.Connection |
getConnection(java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String driverPathName,
java.lang.String driverClassName)
Attempts to establish a connection to the given database URL. |
private static java.sql.Connection |
getConnectionForDriver(java.lang.String url,
java.lang.String user,
java.lang.String password,
java.sql.Driver driver)
|
private static java.io.File |
getDriversDir()
|
private static java.sql.Driver |
loadDriver(java.io.File path,
java.lang.String driverClassName)
|
static void |
loadDriverClass(java.lang.String driverClassName)
Load the driver class |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static Trace logger
private static java.util.Set defaultDrivers
private static java.util.Map namedDrivers
Constructor Detail |
public DriverManager()
Method Detail |
public static java.sql.Connection getConnection(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String driverPathName, java.lang.String driverClassName) throws java.sql.SQLException
DriverManager
attempts to select an appropriate driver from
the set of registered JDBC drivers.
url
- a database url of the form
jdbc:subprotocol:subname
user
- the database user on whose behalf the connection is being madepassword
- the user's passworddriverPathName
- the path where the driver classes are located, null
if default directorydriverClassName
- the class name of the driver
java.sql.SQLException
- if a database access error occurspublic static void loadDriverClass(java.lang.String driverClassName) throws java.lang.ClassNotFoundException
driverClassName
- the class name of the driver
java.lang.ClassNotFoundException
- if the class could not be foundpublic static java.io.File convertToAbsolutePath(java.lang.String pathName) throws java.io.IOException
pathName
- the relativ or absolute path
java.io.IOException
- if the converted path does not existprivate static java.io.File getDriversDir() throws java.io.IOException
java.io.IOException
private static java.sql.Connection getConnectionForDriver(java.lang.String url, java.lang.String user, java.lang.String password, java.sql.Driver driver) throws java.sql.SQLException
java.sql.SQLException
private static java.sql.Driver loadDriver(java.io.File path, java.lang.String driverClassName) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |