Package org.dbunit.database
Interface IDatabaseConnection
- All Known Implementing Classes:
AbstractDatabaseConnection,DatabaseConnection,DatabaseDataSourceConnection,Db2Connection,H2Connection,HsqldbConnection,MckoiConnection,MsSqlConnection,MySqlConnection,OracleConnection
public interface IDatabaseConnection
This interface represents a connection to a specific database.
- Since:
- Mar 6, 2002
- Version:
- $Revision$
- Author:
- Manuel Laflamme
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this connection.Creates a dataset corresponding to the entire database.createDataSet(String[] tableNames) Creates a dataset containing only the specified tables from the database.createQueryTable(String tableName, String sql) Creates a table with the result of the specified SQL statement.createTable(String tableName) Creates a table with the result of aselect * from tableNameSQL statement.createTable(String tableName, PreparedStatement preparedStatement) Creates a table using the given PreparedStatement to retrieve a ResultSet.Returns this connection database configurationReturns a JDBC database connection.intgetRowCount(String tableName) Returns the specified table row count.intgetRowCount(String tableName, String whereClause) Returns the specified table row count according specified where clause.Returns the database schema name.Deprecated.
-
Method Details
-
getConnection
Returns a JDBC database connection.- Throws:
SQLException
-
getSchema
String getSchema()Returns the database schema name. -
close
Close this connection.- Throws:
SQLException
-
createDataSet
Creates a dataset corresponding to the entire database.- Throws:
SQLException
-
createDataSet
Creates a dataset containing only the specified tables from the database.- Parameters:
tableNames- The tables for which a dataset shall be created- Returns:
- The new dataset
- Throws:
SQLExceptionDataSetException
-
createQueryTable
Creates a table with the result of the specified SQL statement. The table can be the result of a join statement.- Parameters:
tableName- The name to be returned byITableMetaData.getTableName().sql- The SQLSELECTstatement- Returns:
- The new table
- Throws:
DataSetExceptionSQLException
-
createTable
ITable createTable(String tableName, PreparedStatement preparedStatement) throws DataSetException, SQLException Creates a table using the given PreparedStatement to retrieve a ResultSet.- Parameters:
tableName- The name to be returned byITableMetaData.getTableName().preparedStatement- The statement to be executed as query- Returns:
- The new table
- Throws:
DataSetExceptionSQLException- Since:
- 2.4.4
-
createTable
Creates a table with the result of aselect * from tableNameSQL statement.- Parameters:
tableName- The name of the database table to be queried which is also returned byITableMetaData.getTableName().- Throws:
DataSetExceptionSQLException
-
getRowCount
Returns the specified table row count.- Parameters:
tableName- the table name- Returns:
- the row count
- Throws:
SQLException
-
getRowCount
Returns the specified table row count according specified where clause.- Parameters:
tableName- the table namewhereClause- the where clause- Returns:
- the row count
- Throws:
SQLException
-
getConfig
DatabaseConfig getConfig()Returns this connection database configuration -
getStatementFactory
IStatementFactory getStatementFactory()Deprecated.UsegetConfig()
-
getConfig()