public class DefaultDataSource extends Object implements DataSource
Constructor and Description |
---|
DefaultDataSource(String url,
String username,
String password) |
Modifier and Type | Method and Description |
---|---|
Connection |
getConnection()
Attempt to establish a database connection.
|
Connection |
getConnection(String username,
String password)
Attempt to establish a database connection.
|
int |
getLoginTimeout()
Gets the maximum time in seconds that this data source can wait while
attempting to connect to a database.
|
PrintWriter |
getLogWriter()
Get the log writer for this data source.
|
Logger |
getParentLogger() |
boolean |
isWrapperFor(Class<?> iface) |
void |
setLoginTimeout(int loginTimeout)
Sets the maximum time in seconds that this data source will wait
while attempting to connect to a database.
|
void |
setLogWriter(PrintWriter logWriter) |
<T> T |
unwrap(Class<T> iface) |
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 int getLoginTimeout() throws SQLException
getLoginTimeout
in interface CommonDataSource
SQLException
public PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface CommonDataSource
SQLException
public void setLoginTimeout(int loginTimeout) throws SQLException
setLoginTimeout
in interface CommonDataSource
loginTimeout
- the loging timeout in secondsSQLException
public void setLogWriter(PrintWriter logWriter) throws SQLException
setLogWriter
in interface CommonDataSource
SQLException
public boolean isWrapperFor(Class<?> iface)
isWrapperFor
in interface Wrapper
public Logger getParentLogger()
getParentLogger
in interface CommonDataSource
Copyright © 1997–2022. All rights reserved.