|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.j256.ormlite.support.BaseConnectionSource
com.j256.ormlite.jdbc.JdbcConnectionSource
public class JdbcConnectionSource
Implementation of the ConnectionSource interface that supports what is needed by ORMLite. This is not thread-safe nor
synchronized. For other dataSources, see the 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.
Field Summary | |
---|---|
protected com.j256.ormlite.db.DatabaseType |
databaseType
|
protected boolean |
initialized
|
Fields inherited from class com.j256.ormlite.support.BaseConnectionSource |
---|
usedSpecialConnection |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
void |
clearSpecialConnection(com.j256.ormlite.support.DatabaseConnection connection)
|
void |
close()
|
com.j256.ormlite.db.DatabaseType |
getDatabaseType()
|
com.j256.ormlite.support.DatabaseConnection |
getReadOnlyConnection()
|
com.j256.ormlite.support.DatabaseConnection |
getReadWriteConnection()
|
String |
getUrl()
|
void |
initialize()
Initialize the class after the setters have been called. |
boolean |
isOpen()
|
protected JdbcDatabaseConnection |
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)
|
void |
setDatabaseType(com.j256.ormlite.db.DatabaseType databaseType)
|
void |
setPassword(String password)
|
void |
setUrl(String url)
|
void |
setUsername(String username)
|
Methods inherited from class com.j256.ormlite.support.BaseConnectionSource |
---|
clearSpecial, getSavedConnection, getSpecialConnection, isSavedConnection, saveSpecial |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.j256.ormlite.support.ConnectionSource |
---|
getSpecialConnection |
Field Detail |
---|
protected com.j256.ormlite.db.DatabaseType databaseType
protected boolean initialized
Constructor Detail |
---|
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.Method Detail |
---|
public void initialize() throws SQLException
SQLException
- If the driver associated with the database URL is not found in the classpath.public void close() throws SQLException
close
in interface com.j256.ormlite.support.ConnectionSource
SQLException
public String getUrl()
public void setUrl(String url)
public com.j256.ormlite.support.DatabaseConnection getReadOnlyConnection() throws SQLException
getReadOnlyConnection
in interface com.j256.ormlite.support.ConnectionSource
SQLException
public com.j256.ormlite.support.DatabaseConnection getReadWriteConnection() throws SQLException
getReadWriteConnection
in interface com.j256.ormlite.support.ConnectionSource
SQLException
public void releaseConnection(com.j256.ormlite.support.DatabaseConnection connection) throws SQLException
releaseConnection
in interface com.j256.ormlite.support.ConnectionSource
SQLException
public boolean saveSpecialConnection(com.j256.ormlite.support.DatabaseConnection connection) throws SQLException
saveSpecialConnection
in interface com.j256.ormlite.support.ConnectionSource
SQLException
public void clearSpecialConnection(com.j256.ormlite.support.DatabaseConnection connection)
clearSpecialConnection
in interface com.j256.ormlite.support.ConnectionSource
public com.j256.ormlite.db.DatabaseType getDatabaseType()
getDatabaseType
in interface com.j256.ormlite.support.ConnectionSource
public boolean isOpen()
isOpen
in interface com.j256.ormlite.support.ConnectionSource
public void setUsername(String username)
public void setPassword(String password)
public void setDatabaseType(com.j256.ormlite.db.DatabaseType databaseType)
protected JdbcDatabaseConnection makeConnection(com.j256.ormlite.logger.Logger logger) throws SQLException
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |