public class DbDataSource extends java.lang.Object implements IDataSource
Constructor and Description |
---|
DbDataSource(javax.sql.DataSource dataSource)
Constructs a DbDataSource object with a JDBC data source.
|
DbDataSource(javax.sql.DataSource dataSource,
boolean cacheConnection)
Constructs a DbDataSource object with a JDBC data source.
|
DbDataSource(DbConnection externalConnection)
Constructs a DbDataSource object with a user managed externalConnection.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes read and write access to the data source.
|
void |
commit()
Commits the changes to the data source.
|
DbConnection |
getConnection()
Returns a database connection.
|
DbConnection |
getExternalConnection()
If external connection is cached, this method returns the cached external connection.
|
boolean |
isConnectionCached()
Whether a connection is cached.
|
boolean |
isExternalConnectionUsed()
Returns true if external connection is used.
|
void |
open()
Opens read and write access to the data source.
|
void |
rollback()
Rolls back the changes from the data source.
|
void |
setExternalConnection(DbConnection externalConnection)
If external connection is to be cached, this method sets the cached external connection to the input connection.
|
public DbDataSource(DbConnection externalConnection)
externalConnection
- public DbDataSource(javax.sql.DataSource dataSource)
dataSource
- JDBC data sourcepublic DbDataSource(javax.sql.DataSource dataSource, boolean cacheConnection)
dataSource
- cacheConnection
- public boolean isExternalConnectionUsed()
public boolean isConnectionCached()
public DbConnection getExternalConnection()
public void setExternalConnection(DbConnection externalConnection)
externalConnection
- public DbConnection getConnection() throws DataSourceException
java.sql.SQLException
DataSourceException
public void open() throws DataSourceException
IDataSource
open
in interface IDataSource
DataSourceException
public void close() throws DataSourceException
IDataSource
close
in interface IDataSource
DataSourceException
public void commit() throws DataSourceException
commit
in interface IDataSource
DataSourceException
public void rollback() throws DataSourceException
rollback
in interface IDataSource
DataSourceException