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.- Author:
- Hans Bergsten
-
-
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()Always throws a SQLFeatureNotSupportedException.booleanisWrapperFor(Class<?> iface)Always return false.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)<T> Tunwrap(Class<T> iface)Always throws a SQLException.-
Methods inherited from class java.lang.Object
clone, equals, finalize, 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
-
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<?> iface) throws SQLException
Always return false.- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
Always throws a SQLException. Not supported.- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
Always throws a SQLFeatureNotSupportedException. Not supported.- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException- Since:
- jdk1.7
-
-