public class BasicDataSource extends Object implements DataSource
DataSource. Uses DriverManager to create connections.| Modifier and Type | Class and Description |
|---|---|
static class |
BasicDataSource.DriverShim
Wraps a Jdbc-Driver.
|
| Constructor and Description |
|---|
BasicDataSource(String driverClassName,
String dbUrl,
String dbUser,
String dbPassword,
DBMS dbms,
int maxPoolSize,
URL... jdbcDriverURL)
Constructor.
|
BasicDataSource(String driverClassName,
String dbUrl,
String dbUser,
String dbPassword,
int maxPoolSize,
File jdbcDriver)
Constructor.
|
BasicDataSource(String driverClassName,
String dbUrl,
String dbUser,
String dbPassword,
int maxPoolSize,
URL... jdbcDriverURL)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes all pooled connections.
|
Connection |
getConnection() |
Connection |
getConnection(String username,
String password) |
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
Logger |
getParentLogger() |
boolean |
isWrapperFor(Class<?> arg0) |
void |
setLoginTimeout(int arg0) |
void |
setLogWriter(PrintWriter arg0) |
<T> T |
unwrap(Class<T> arg0) |
public final DBMS dbms
public BasicDataSource(String driverClassName, String dbUrl, String dbUser, String dbPassword, int maxPoolSize, File jdbcDriver)
driverClassName - name of JDBC-driver classdbUrl - the URLdbUser - the userdbPassword - the passwordmaxPoolSize - maximum number of pooled connectionsjdbcDriver - driver jar filepublic BasicDataSource(String driverClassName, String dbUrl, String dbUser, String dbPassword, int maxPoolSize, URL... jdbcDriverURL)
driverClassName - name of JDBC-driver classdbUrl - the URLdbUser - the userdbPassword - the passwordmaxPoolSize - maximum number of pooled connectionsjdbcDriverURL - URL of driver jar filepublic BasicDataSource(String driverClassName, String dbUrl, String dbUser, String dbPassword, DBMS dbms, int maxPoolSize, URL... jdbcDriverURL)
driverClassName - name of JDBC-driver classdbUrl - the URLdbUser - the userdbPassword - the passwordmaxPoolSize - maximum number of pooled connectionsdbms - the DBMSpublic void close()
public Connection getConnection() throws SQLException
getConnection in interface DataSourceSQLExceptionpublic PrintWriter getLogWriter() throws SQLException
getLogWriter in interface CommonDataSourceSQLExceptionpublic int getLoginTimeout()
throws SQLException
getLoginTimeout in interface CommonDataSourceSQLExceptionpublic Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger in interface CommonDataSourceSQLFeatureNotSupportedExceptionpublic void setLogWriter(PrintWriter arg0) throws SQLException
setLogWriter in interface CommonDataSourceSQLExceptionpublic void setLoginTimeout(int arg0)
throws SQLException
setLoginTimeout in interface CommonDataSourceSQLExceptionpublic boolean isWrapperFor(Class<?> arg0) throws SQLException
isWrapperFor in interface WrapperSQLExceptionpublic <T> T unwrap(Class<T> arg0) throws SQLException
unwrap in interface WrapperSQLExceptionpublic Connection getConnection(String username, String password) throws SQLException
getConnection in interface DataSourceSQLException