public static class DefaultConnectionPoolFactory.DriverManagerDataSource extends Object implements DataSource
It should be noted that setting the log writer and login timeout will apply to DriverManager and NOT to the Data Source on its own. If you have 2 or more DataSource's they will have THE SAME log writer and login timeout.
Constructor and Description |
---|
DriverManagerDataSource(String driverName,
String url,
String userName,
String password,
org.datanucleus.ClassLoaderResolver clr,
Properties props)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Equality operator.
|
Connection |
getConnection()
Accessor for a JDBC connection for this data source.
|
Connection |
getConnection(String userName,
String password)
Accessor for a JDBC connection for this data source, specifying username and password.
|
int |
getLoginTimeout()
Accessor for the Login timeout for the driver manager.
|
PrintWriter |
getLogWriter()
Accessor for the LogWriter of the driver manager.
|
Logger |
getParentLogger() |
int |
hashCode()
Hashcode operator.
|
boolean |
isWrapperFor(Class iface) |
void |
setLoginTimeout(int seconds)
Mutator for the Login timeout for the driver manager.
|
void |
setLogWriter(PrintWriter out)
Mutator for the LogWriter of the driver manager.
|
Object |
unwrap(Class iface) |
public DriverManagerDataSource(String driverName, String url, String userName, String password, org.datanucleus.ClassLoaderResolver clr, Properties props)
driverName
- Class name of the JDBC driver.url
- URL of the data source.userName
- User namepassword
- User passwordclr
- ClassLoaderResolver to use for loading issuesprops
- Any custom properties for the driverpublic Connection getConnection() throws SQLException
getConnection
in interface DataSource
SQLException
- Thrown when an error occurs obtaining the connection.public Connection getConnection(String userName, String password) throws SQLException
getConnection
in interface DataSource
userName
- User name for the data source (this user name is ignored)password
- Password for the data source (this password is ignored)SQLException
- Thrown when an error occurs obtaining the connection.public PrintWriter getLogWriter()
getLogWriter
in interface CommonDataSource
public void setLogWriter(PrintWriter out)
setLogWriter
in interface CommonDataSource
out
- The Log Writerpublic int getLoginTimeout()
getLoginTimeout
in interface CommonDataSource
public void setLoginTimeout(int seconds)
setLoginTimeout
in interface CommonDataSource
seconds
- The login timeout (seconds)public boolean equals(Object obj)
public int hashCode()
public Object unwrap(Class iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public boolean isWrapperFor(Class iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger
in interface CommonDataSource
SQLFeatureNotSupportedException
Copyright © 2017. All rights reserved.