|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pf.db.util.DataSourceProxy
public class DataSourceProxy
This class is a datasource wrapper for other datasources or simple connections. It allows to pass simple connection information such as url, userid, password as a datasource to other objects that require a javax.sql.DataSource rather than java.sql.Connection as input. In addition the wrapping of other datasource objects plus their associated userid/password data is supported. That allows to pass around just one object that can be asked to return a connection via getConnection().
Constructor Summary | |
---|---|
DataSourceProxy(Connection conn)
Initialize the new instance with a ready-to-use connection. |
|
DataSourceProxy(DataSource dataSource)
|
|
DataSourceProxy(DataSource dataSource,
String username,
String password)
|
|
DataSourceProxy(String url)
Initialize the new instance with an URL for the database connection. |
|
DataSourceProxy(String url,
String username,
String password)
Initialize the new instance with all necessary connection information. |
Method Summary | ||
---|---|---|
Connection |
getConnection()
Attempt to establish a database connection |
|
Connection |
getConnection(String username,
String password)
Attempt to establish a database connection |
|
String |
getDbPassword()
|
|
String |
getDbUrl()
|
|
String |
getDbUserid()
|
|
int |
getLoginTimeout()
Returns the maximum time in seconds that this data source can wait while attempting to connect to a database. |
|
PrintWriter |
getLogWriter()
Returns the log writer for this data source |
|
boolean |
isWrapperFor(Class<?> iface)
Always returns false. |
|
void |
setDbPassword(String password)
|
|
void |
setDbUrl(String url)
|
|
void |
setDbUserid(String userId)
|
|
void |
setDriverClassName(String driverClassName)
Creates an instance of the given class name in order to register the database driver. |
|
void |
setLoginTimeout(int timeout)
Sets the maximum time in seconds that this data source can wait while attempting to connect to a database. |
|
void |
setLogWriter(PrintWriter writer)
Sets the log writer for this data source |
|
|
unwrap(Class<T> iface)
Always throws SQLException, becaus eno interfaces are supported. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataSourceProxy(Connection conn)
public DataSourceProxy(String url, String username, String password)
public DataSourceProxy(String url)
public DataSourceProxy(DataSource dataSource, String username, String password)
public DataSourceProxy(DataSource dataSource)
Method Detail |
---|
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 boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public String getDbUrl()
public void setDbUrl(String url)
public String getDbUserid()
public void setDbUserid(String userId)
public String getDbPassword()
public void setDbPassword(String password)
public int getLoginTimeout() throws SQLException
getLoginTimeout
in interface CommonDataSource
SQLException
public PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface CommonDataSource
SQLException
public void setLoginTimeout(int timeout) throws SQLException
setLoginTimeout
in interface CommonDataSource
SQLException
public void setLogWriter(PrintWriter writer) throws SQLException
setLogWriter
in interface CommonDataSource
SQLException
public void setDriverClassName(String driverClassName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |