Class DataSourceWrapper
- java.lang.Object
-
- org.apache.taglibs.standard.tag.common.sql.DataSourceWrapper
-
- All Implemented Interfaces:
Wrapper,CommonDataSource,DataSource
public class DataSourceWrapper extends Object implements DataSource
A simple
DataSourcewrapper for the standardDriverManagerclass.
-
-
Constructor Summary
Constructors Constructor Description DataSourceWrapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectiongetConnection()Returns a Connection using the DriverManager and all set properties.ConnectiongetConnection(String username, String password)Always throws a SQLException.intgetLoginTimeout()Always throws a SQLException.PrintWritergetLogWriter()Always throws a SQLException.LoggergetParentLogger()booleanisWrapperFor(Class c)voidsetDriverClassName(String driverClassName)voidsetJdbcURL(String jdbcURL)voidsetLoginTimeout(int seconds)Always throws a SQLException.voidsetLogWriter(PrintWriter out)Always throws a SQLException.voidsetPassword(String password)voidsetUserName(String userName)Objectunwrap(Class c)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder
-
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
-
-
-
Method Detail
-
setDriverClassName
public void setDriverClassName(String driverClassName) throws ClassNotFoundException, InstantiationException, IllegalAccessException
-
setJdbcURL
public void setJdbcURL(String jdbcURL)
-
setUserName
public void setUserName(String userName)
-
setPassword
public void setPassword(String password)
-
getConnection
public Connection getConnection() throws SQLException
Returns a Connection using the DriverManager and all set properties.- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getConnection
public Connection getConnection(String username, String password) throws SQLException
Always throws a SQLException. Username and password are set in the constructor and can not be changed.- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getLoginTimeout
public int getLoginTimeout() throws SQLExceptionAlways throws a SQLException. Not supported.- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger()
- Specified by:
getParentLoggerin interfaceCommonDataSource
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
Always throws a SQLException. Not supported.- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLExceptionAlways throws a SQLException. Not supported.- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
Always throws a SQLException. Not supported.- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class c) throws SQLException
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
unwrap
public Object unwrap(Class c) throws SQLException
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
-