public class JdbcSingleConnectionSource extends JdbcConnectionSource implements com.j256.ormlite.support.ConnectionSource
DataSourceConnectionSource
class.
NOTE: If you are using the Spring type wiring in Java, initialize()
should be called after all of the
set methods. In Spring XML, init-method="initialize" should be used.
connection, databaseType, initialized
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 |
initialize()
Initialize the class after the setters have been called.
|
void |
releaseConnection(com.j256.ormlite.support.DatabaseConnection connection) |
void |
setSqlConnection(Connection sqlConnection) |
clearSpecialConnection, closeQuietly, getDatabaseType, getReadOnlyConnection, getReadWriteConnection, getUrl, isOpen, isSingleConnection, makeConnection, saveSpecialConnection, setDatabaseConnectionProxyFactory, setDatabaseType, setPassword, setUrl, setUsername
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 initialize() throws SQLException
JdbcConnectionSource
initialize
in class JdbcConnectionSource
SQLException
- If the driver associated with the database URL is not found in the classpath.public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class JdbcConnectionSource
public void releaseConnection(com.j256.ormlite.support.DatabaseConnection connection)
releaseConnection
in interface com.j256.ormlite.support.ConnectionSource
releaseConnection
in class JdbcConnectionSource
public void setSqlConnection(Connection sqlConnection)
This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.