public class JdbcSingleConnectionSource extends BaseJdbcConnectionSource implements com.j256.ormlite.support.ConnectionSource
DataSourceConnectionSource
class.
NOTE: If you are using the Spring type wiring in Java, BaseJdbcConnectionSource.initialize()
should be called after all of the
set methods. In Spring XML, init-method="initialize" should be used.
connection, databaseType, initialized, logger, url
Constructor and Description |
---|
JdbcSingleConnectionSource()
Constructor for Spring type wiring if you are using the set methods.
|
JdbcSingleConnectionSource(String url,
Connection sqlConnection)
Create a data source for a particular database URL.
|
JdbcSingleConnectionSource(String url,
com.j256.ormlite.db.DatabaseType databaseType,
Connection sqlConnection)
Create a data source for a particular database URL.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
closeQuietly() |
protected com.j256.ormlite.support.DatabaseConnection |
makeConnection(com.j256.ormlite.logger.Logger logger)
Make a connection to the database.
|
void |
setSqlConnection(Connection sqlConnection) |
clearSpecialConnection, getDatabaseType, getReadOnlyConnection, getReadWriteConnection, getUrl, initialize, isOpen, isSingleConnection, releaseConnection, saveSpecialConnection, setDatabaseConnectionProxyFactory, setDatabaseType, setUrl
clearSpecial, getSavedConnection, getSpecialConnection, isSavedConnection, isSingleConnection, saveSpecial
public JdbcSingleConnectionSource()
public JdbcSingleConnectionSource(String url, Connection sqlConnection) throws SQLException
url
- The database URL which should start jdbc:...sqlConnection
- Already open database connection that we will use.SQLException
- If the driver associated with the database driver is not found in the classpath.public JdbcSingleConnectionSource(String url, com.j256.ormlite.db.DatabaseType databaseType, Connection sqlConnection) throws SQLException
JdbcSingleConnectionSource(String, Connection)
instead. If, however, you need
to force the class to use a specific DatabaseType then this constructor should be used.url
- The database URL which should start jdbc:...databaseType
- Database to associate with this connection source.sqlConnection
- Already open database connection that we will use.SQLException
- If the driver associated with the database driver is not found in the classpath.public void close()
close
in interface AutoCloseable
close
in class BaseJdbcConnectionSource
public void closeQuietly()
closeQuietly
in interface com.j256.ormlite.support.ConnectionSource
closeQuietly
in class BaseJdbcConnectionSource
public void setSqlConnection(Connection sqlConnection)
protected com.j256.ormlite.support.DatabaseConnection makeConnection(com.j256.ormlite.logger.Logger logger)
BaseJdbcConnectionSource
makeConnection
in class BaseJdbcConnectionSource
logger
- This is here so we can use the right logger associated with the sub-class.This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.