Class DriverManagerAccessor
- java.lang.Object
-
- org.apache.taglibs.standard.tag.common.sql.DriverManagerAccessor
-
public class DriverManagerAccessor extends java.lang.Object
Class that provides access toDriverManager
. 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 Summary
Constructors Constructor Description DriverManagerAccessor()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.sql.Connection
getConnection(java.lang.String jdbcURL)
Delegates toDriverManager.getConnection(String)
.static java.sql.Connection
getConnection(java.lang.String jdbcURL, java.lang.String userName, java.lang.String password)
Delegates toDriverManager.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)
-
-
-
Method Detail
-
getConnection
public static java.sql.Connection getConnection(java.lang.String jdbcURL, java.lang.String userName, java.lang.String password) throws java.sql.SQLException
Delegates toDriverManager.getConnection(String, String, String)
. If this fails it attempts to load a class into the class loader cl and tries again.- Parameters:
jdbcURL
- The JDBC urluserName
- The usernamepassword
- The password- Returns:
- A database connection
- Throws:
java.sql.SQLException
-
getRealConnection
private static java.sql.Connection getRealConnection(java.lang.String jdbcURL, java.lang.String userName, java.lang.String password) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getConnection
public static java.sql.Connection getConnection(java.lang.String jdbcURL) throws java.sql.SQLException
Delegates toDriverManager.getConnection(String)
. If this fails it attempts to load a class into the class loader cl and tries again.- Parameters:
jdbcURL
- The JDBC url- Returns:
- A database connection
- Throws:
java.sql.SQLException
-
getRealConnection
private static java.sql.Connection getRealConnection(java.lang.String jdbcURL) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
-