public abstract class BaseJdbcConnectionSource
extends com.j256.ormlite.support.BaseConnectionSource
implements com.j256.ormlite.support.ConnectionSource
| Modifier and Type | Field and Description |
|---|---|
protected com.j256.ormlite.support.DatabaseConnection |
connection |
protected com.j256.ormlite.db.DatabaseType |
databaseType |
protected boolean |
initialized |
protected static com.j256.ormlite.logger.Logger |
logger |
protected String |
url |
| Modifier | Constructor and Description |
|---|---|
|
BaseJdbcConnectionSource()
Constructor for Spring type wiring if you are using the set methods.
|
|
BaseJdbcConnectionSource(String url)
Create a data source for a particular database URL.
|
|
BaseJdbcConnectionSource(String url,
com.j256.ormlite.db.DatabaseType databaseType)
Create a data source for a particular database URL.
|
protected |
BaseJdbcConnectionSource(String url,
com.j256.ormlite.db.DatabaseType databaseType,
boolean initialize)
Set initialize to false if you don't want to initialize.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearSpecialConnection(com.j256.ormlite.support.DatabaseConnection connection) |
void |
close() |
void |
closeQuietly() |
com.j256.ormlite.db.DatabaseType |
getDatabaseType() |
com.j256.ormlite.support.DatabaseConnection |
getReadOnlyConnection(String tableName) |
com.j256.ormlite.support.DatabaseConnection |
getReadWriteConnection(String tableName) |
String |
getUrl() |
void |
initialize()
Initialize the class after the setters have been called.
|
boolean |
isOpen(String tableName) |
boolean |
isSingleConnection(String tableName) |
protected abstract com.j256.ormlite.support.DatabaseConnection |
makeConnection(com.j256.ormlite.logger.Logger logger)
Make a connection to the database.
|
void |
releaseConnection(com.j256.ormlite.support.DatabaseConnection connection) |
boolean |
saveSpecialConnection(com.j256.ormlite.support.DatabaseConnection connection) |
static void |
setDatabaseConnectionProxyFactory(com.j256.ormlite.support.DatabaseConnectionProxyFactory connectionProxyFactory)
Set to enable connection proxying.
|
void |
setDatabaseType(com.j256.ormlite.db.DatabaseType databaseType) |
void |
setUrl(String url) |
clearSpecial, getSavedConnection, getSpecialConnection, isSavedConnection, isSingleConnection, saveSpecialprotected static com.j256.ormlite.logger.Logger logger
protected String url
protected com.j256.ormlite.support.DatabaseConnection connection
protected com.j256.ormlite.db.DatabaseType databaseType
protected boolean initialized
public BaseJdbcConnectionSource()
public BaseJdbcConnectionSource(String url) throws SQLException
url - The database URL which should start jdbc:...SQLException - If the driver associated with the database driver is not found in the classpath.public BaseJdbcConnectionSource(String url, com.j256.ormlite.db.DatabaseType databaseType) throws SQLException
BaseJdbcConnectionSource(String) 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.SQLException - If the driver associated with the database driver is not found in the classpath.protected BaseJdbcConnectionSource(String url, com.j256.ormlite.db.DatabaseType databaseType, boolean initialize) throws SQLException
SQLExceptionprotected abstract com.j256.ormlite.support.DatabaseConnection makeConnection(com.j256.ormlite.logger.Logger logger)
throws SQLException
logger - This is here so we can use the right logger associated with the sub-class.SQLExceptionpublic void initialize()
throws SQLException
SQLException - If the driver associated with the database URL is not found in the classpath.public void close()
throws Exception
close in interface AutoCloseableExceptionpublic void closeQuietly()
closeQuietly in interface com.j256.ormlite.support.ConnectionSourcepublic String getUrl()
public void setUrl(String url)
public com.j256.ormlite.support.DatabaseConnection getReadOnlyConnection(String tableName) throws SQLException
getReadOnlyConnection in interface com.j256.ormlite.support.ConnectionSourceSQLExceptionpublic com.j256.ormlite.support.DatabaseConnection getReadWriteConnection(String tableName) throws SQLException
getReadWriteConnection in interface com.j256.ormlite.support.ConnectionSourceSQLExceptionpublic void releaseConnection(com.j256.ormlite.support.DatabaseConnection connection)
throws SQLException
releaseConnection in interface com.j256.ormlite.support.ConnectionSourceSQLExceptionpublic boolean saveSpecialConnection(com.j256.ormlite.support.DatabaseConnection connection)
throws SQLException
saveSpecialConnection in interface com.j256.ormlite.support.ConnectionSourceSQLExceptionpublic void clearSpecialConnection(com.j256.ormlite.support.DatabaseConnection connection)
clearSpecialConnection in interface com.j256.ormlite.support.ConnectionSourcepublic com.j256.ormlite.db.DatabaseType getDatabaseType()
getDatabaseType in interface com.j256.ormlite.support.ConnectionSourcepublic boolean isOpen(String tableName)
isOpen in interface com.j256.ormlite.support.ConnectionSourcepublic boolean isSingleConnection(String tableName)
isSingleConnection in interface com.j256.ormlite.support.ConnectionSourcepublic void setDatabaseType(com.j256.ormlite.db.DatabaseType databaseType)
public static void setDatabaseConnectionProxyFactory(com.j256.ormlite.support.DatabaseConnectionProxyFactory connectionProxyFactory)
This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.