public class DbUnitDatabaseConnection
extends org.dbunit.database.AbstractDatabaseConnection
IDatabaseConnection interface. This implementation returns connections from
an underlying DataSource. This implementation stores the Connection that was retrieved last,
to enable closing it (or returing it to the pool) using closeJdbcConnection().| Constructor and Description |
|---|
DbUnitDatabaseConnection(DataSource dataSource,
String schemaName)
Creates a new instance that wraps the given
DataSource |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Method that is invoked by DBUnit when the connection is no longer needed.
|
void |
closeJdbcConnection()
Closes the
Connection that was last retrieved using the getConnection() method |
Connection |
getConnection()
Returns a
Connection that can be used by DBUnit. |
protected Connection |
getNativeConnection(Connection connection) |
String |
getSchema() |
public DbUnitDatabaseConnection(DataSource dataSource, String schemaName)
DataSourcedataSource - The data source, not nullschemaName - The database schema, not nullpublic void close()
throws SQLException
SQLExceptionpublic String getSchema()
public Connection getConnection() throws SQLException
Connection that can be used by DBUnit. A reference to the connection is kept, to be able
to 'close' it (return it to the connection pool) after the DBUnit operation finished. If an open connection
is already in use by DBUnit, this connection is returnedSQLExceptionprotected Connection getNativeConnection(Connection connection) throws SQLException
connection - The wrapper connection, not nullSQLExceptionpublic void closeJdbcConnection()
throws SQLException
Connection that was last retrieved using the getConnection() methodSQLException - When connection close failsCopyright © 2017. All rights reserved.