public class DataSourceWrapper
extends java.lang.Object
implements javax.sql.DataSource
A simple DataSource
wrapper for the standard
DriverManager
class.
Modifier and Type | Field and Description |
---|---|
private java.sql.Driver |
driver |
private java.lang.String |
jdbcURL |
private java.lang.String |
password |
private java.lang.String |
userName |
Constructor and Description |
---|
DataSourceWrapper() |
Modifier and Type | Method and Description |
---|---|
java.sql.Connection |
getConnection()
Returns a Connection using the DriverManager and all
set properties.
|
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Always throws a SQLException.
|
int |
getLoginTimeout()
Always throws a SQLException.
|
java.io.PrintWriter |
getLogWriter()
Always throws a SQLException.
|
java.util.logging.Logger |
getParentLogger() |
boolean |
isWrapperFor(java.lang.Class c) |
void |
setDriverClassName(java.lang.String driverClassName) |
void |
setJdbcURL(java.lang.String jdbcURL) |
void |
setLoginTimeout(int seconds)
Always throws a SQLException.
|
void |
setLogWriter(java.io.PrintWriter out)
Always throws a SQLException.
|
void |
setPassword(java.lang.String password) |
void |
setUserName(java.lang.String userName) |
java.lang.Object |
unwrap(java.lang.Class c) |
private java.sql.Driver driver
private java.lang.String jdbcURL
private java.lang.String userName
private java.lang.String password
public void setDriverClassName(java.lang.String driverClassName) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
public void setJdbcURL(java.lang.String jdbcURL)
public void setUserName(java.lang.String userName)
public void setPassword(java.lang.String password)
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
public int getLoginTimeout() throws java.sql.SQLException
getLoginTimeout
in interface javax.sql.CommonDataSource
java.sql.SQLException
public java.util.logging.Logger getParentLogger()
getParentLogger
in interface javax.sql.CommonDataSource
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
getLogWriter
in interface javax.sql.CommonDataSource
java.sql.SQLException
public void setLoginTimeout(int seconds) throws java.sql.SQLException
setLoginTimeout
in interface javax.sql.CommonDataSource
java.sql.SQLException
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
setLogWriter
in interface javax.sql.CommonDataSource
java.sql.SQLException
public boolean isWrapperFor(java.lang.Class c) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
java.sql.SQLException
public java.lang.Object unwrap(java.lang.Class c) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
java.sql.SQLException