public class DriverManagerAccessor extends 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 Connection |
getConnection(String jdbcURL)
Delegates to
DriverManager.getConnection(String) . |
static Connection |
getConnection(String jdbcURL,
String userName,
String password)
Delegates to
DriverManager.getConnection(String, String, String) . |
public static Connection getConnection(String jdbcURL, String userName, String password) throws 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 passwordSQLException
public static Connection getConnection(String jdbcURL) throws SQLException
DriverManager.getConnection(String)
. If this fails it attempts to
load a class into the class loader cl and tries again.jdbcURL
- The JDBC urlSQLException
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.