Class BasicDataSource
java.lang.Object
net.sf.jailer.database.BasicDataSource
- All Implemented Interfaces:
Wrapper,CommonDataSource,DataSource
Basic implementation of
DataSource. Uses DriverManager to create connections.- Author:
- Ralf Wisser
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBasicDataSource(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.BasicDataSource(String driverClassName, String dbUrl, String dbUser, String dbPassword, DBMS dbms, int maxPoolSize, URL... jdbcDriverURL) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes all pooled connections.static booleanfindDBMSNeedsConnection(String dbUrl) Checks whether determining the DBMS for a given URL requires a connection.getConnection(String username, String password) intbooleanisWrapperFor(Class<?> arg0) voidsetLoginTimeout(int arg0) voidsetLogWriter(PrintWriter arg0) <T> TMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilderMethods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
Field Details
-
dbms
The DBMS.
-
-
Constructor Details
-
BasicDataSource
public BasicDataSource(String driverClassName, String dbUrl, String dbUser, String dbPassword, int maxPoolSize, File jdbcDriver) Constructor. Derives DBMS from URL.- Parameters:
driverClassName- name of JDBC-driver classdbUrl- the URLdbUser- the userdbPassword- the passwordmaxPoolSize- maximum number of pooled connectionsjdbcDriver- driver jar file
-
BasicDataSource
public BasicDataSource(String driverClassName, String dbUrl, String dbUser, String dbPassword, int maxPoolSize, URL... jdbcDriverURL) Constructor. Derives DBMS from URL.- Parameters:
driverClassName- name of JDBC-driver classdbUrl- the URLdbUser- the userdbPassword- the passwordmaxPoolSize- maximum number of pooled connectionsjdbcDriverURL- URL of driver jar file
-
BasicDataSource
public BasicDataSource(String driverClassName, String dbUrl, String dbUser, String dbPassword, DBMS dbms, int maxPoolSize, URL... jdbcDriverURL) Constructor.- Parameters:
driverClassName- name of JDBC-driver classdbUrl- the URLdbUser- the userdbPassword- the passworddbms- the DBMSmaxPoolSize- maximum number of pooled connectionsjdbcDriverURL- URL(s) of driver jar file
-
-
Method Details
-
close
public void close()Closes all pooled connections. -
findDBMSNeedsConnection
Checks whether determining the DBMS for a given URL requires a connection.- Parameters:
dbUrl- the DB URL- Returns:
trueif a connection is needed to determine the DBMS
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getLogWriter
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
getLoginTimeout
- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getParentLogger
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-
setLogWriter
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-