public class DriverManagerAccessor
extends java.lang.Object
DriverManager.
DriverManager is not compatible with a modular environment, as it does no allow direct
access to driver classes that the callers class loader cannot load. This class allows access
to DriverManager by being forced into a cl that does have access and then invoking the DriverManager
methods.
This is a horrible hack.| Constructor and Description |
|---|
DriverManagerAccessor() |
| Modifier and Type | Method and Description |
|---|---|
static java.sql.Connection |
getConnection(java.lang.String jdbcURL)
Delegates to
DriverManager.getConnection(String). |
static java.sql.Connection |
getConnection(java.lang.String jdbcURL,
java.lang.String userName,
java.lang.String password)
Delegates to
DriverManager.getConnection(String, String, String). |
private static java.sql.Connection |
getRealConnection(java.lang.String jdbcURL) |
private static java.sql.Connection |
getRealConnection(java.lang.String jdbcURL,
java.lang.String userName,
java.lang.String password) |
public static java.sql.Connection getConnection(java.lang.String jdbcURL,
java.lang.String userName,
java.lang.String password)
throws java.sql.SQLException
DriverManager.getConnection(String, String, String). If this fails it attempts to
load a class into the class loader cl and tries again.jdbcURL - The JDBC urluserName - The usernamepassword - The passwordjava.sql.SQLExceptionprivate static java.sql.Connection getRealConnection(java.lang.String jdbcURL,
java.lang.String userName,
java.lang.String password)
throws java.sql.SQLException
java.sql.SQLExceptionpublic static java.sql.Connection getConnection(java.lang.String jdbcURL)
throws java.sql.SQLException
DriverManager.getConnection(String). If this fails it attempts to
load a class into the class loader cl and tries again.jdbcURL - The JDBC urljava.sql.SQLExceptionprivate static java.sql.Connection getRealConnection(java.lang.String jdbcURL)
throws java.sql.SQLException
java.sql.SQLException