public class JdbcConnectionSource 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 |
---|
JdbcConnectionSource()
Constructor for Spring type wiring if you are using the set methods.
|
JdbcConnectionSource(String url)
Create a data source for a particular database URL.
|
JdbcConnectionSource(String url,
com.j256.ormlite.db.DatabaseType databaseType)
Create a data source for a particular database URL.
|
JdbcConnectionSource(String url,
String username,
String password)
Create a data source for a particular database URL with username and password permissions.
|
JdbcConnectionSource(String url,
String username,
String password,
com.j256.ormlite.db.DatabaseType databaseType)
Create a data source for a particular database URL with username and password permissions.
|
Modifier and Type | Method and Description |
---|---|
protected com.j256.ormlite.support.DatabaseConnection |
makeConnection(com.j256.ormlite.logger.Logger logger)
Make a connection to the database.
|
void |
setLoginTimeoutSecs(Integer loginTimeoutSecs)
Set the connection timeout number of seconds.
|
void |
setPassword(String password) |
void |
setUsername(String username) |
clearSpecialConnection, close, closeQuietly, getDatabaseType, getReadOnlyConnection, getReadWriteConnection, getUrl, initialize, isOpen, isSingleConnection, releaseConnection, saveSpecialConnection, setDatabaseConnectionProxyFactory, setDatabaseType, setUrl
clearSpecial, getSavedConnection, getSpecialConnection, isSavedConnection, isSingleConnection, saveSpecial
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearSpecialConnection, closeQuietly, getDatabaseType, getReadOnlyConnection, getReadWriteConnection, getSpecialConnection, isOpen, isSingleConnection, releaseConnection, saveSpecialConnection
close
public JdbcConnectionSource()
public JdbcConnectionSource(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 JdbcConnectionSource(String url, com.j256.ormlite.db.DatabaseType databaseType) throws SQLException
JdbcConnectionSource(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.public JdbcConnectionSource(String url, String username, String password) throws SQLException
url
- The database URL which should start jdbc:...username
- Username for permissions on the database.password
- Password for permissions on the database.SQLException
- If the driver associated with the database driver is not found in the classpath.public JdbcConnectionSource(String url, String username, String password, com.j256.ormlite.db.DatabaseType databaseType) throws SQLException
JdbcConnectionSource(String, String, 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:...username
- Username for permissions on the database.password
- Password for permissions on the database.databaseType
- Database to associate with this connection source.SQLException
- If the driver associated with the database driver is not found in the classpath.public void setUsername(String username)
public void setPassword(String password)
public void setLoginTimeoutSecs(Integer loginTimeoutSecs)
protected com.j256.ormlite.support.DatabaseConnection makeConnection(com.j256.ormlite.logger.Logger logger) throws SQLException
BaseJdbcConnectionSource
makeConnection
in class BaseJdbcConnectionSource
logger
- This is here so we can use the right logger associated with the sub-class.SQLException
This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.