public class DataSourceWrapper extends Object implements DataSource
DataSource
except for the getConnection()
method,
which delegates to DataSource#getConnection(String, String)
with the username and password
which are given on construction.Constructor and Description |
---|
DataSourceWrapper(DataSource dataSource,
String username,
String password) |
Modifier and Type | Method and Description |
---|---|
Connection |
getConnection() |
Connection |
getConnection(String username,
String password) |
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
Logger |
getParentLogger()
Unsupported Java 7 method.
|
boolean |
isWrapperFor(Class<?> arg0)
Java 6 method.
|
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(PrintWriter out) |
<T> T |
unwrap(Class<T> arg0)
Java 6 method.
|
public DataSourceWrapper(DataSource dataSource, String username, String password)
dataSource
- the DataSource
to wrapusername
- the username to usepassword
- the password to usepublic boolean isWrapperFor(Class<?> arg0) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public <T> T unwrap(Class<T> arg0) throws SQLException
unwrap
in interface Wrapper
SQLException
public Logger getParentLogger()
getParentLogger
in interface CommonDataSource
public Connection getConnection() throws SQLException
getConnection
in interface DataSource
SQLException
public Connection getConnection(String username, String password) throws SQLException
getConnection
in interface DataSource
SQLException
public PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface CommonDataSource
SQLException
public int getLoginTimeout() throws SQLException
getLoginTimeout
in interface CommonDataSource
SQLException
public void setLogWriter(PrintWriter out) throws SQLException
setLogWriter
in interface CommonDataSource
SQLException
public void setLoginTimeout(int seconds) throws SQLException
setLoginTimeout
in interface CommonDataSource
SQLException
Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.