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: 965 $
Author:
Manuel Laflamme

Method Summary
 void close()
          Close this connection.
 IDataSet createDataSet()
          Creates a dataset corresponding to the entire database.
 IDataSet createDataSet(String[] tableNames)
          Creates a dataset containing only the specified tables from the database.
 ITable createQueryTable(String tableName, String sql)
          Creates a table with the result of the specified SQL statement.
 ITable createTable(String tableName)
          Creates a table with the result of a select * from tableName SQL statement.
 ITable createTable(String tableName, PreparedStatement preparedStatement)
          Creates a table using the given PreparedStatement to retrieve a ResultSet.
 DatabaseConfig getConfig()
          Returns this connection database configuration
 Connection getConnection()
          Returns a JDBC database connection.
 int getRowCount(String tableName)
          Returns the specified table row count.
 int getRowCount(String tableName, String whereClause)
          Returns the specified table row count according specified where clause.
 String getSchema()
          Returns the database schema name.
 IStatementFactory getStatementFactory()
          Deprecated. Use getConfig()
 

Method Detail

getConnection

Connection getConnection()
                         throws SQLException
Returns a JDBC database connection.

Throws:
SQLException

getSchema

String getSchema()
Returns the database schema name.


close

void close()
           throws SQLException
Close this connection.

Throws:
SQLException

createDataSet

IDataSet createDataSet()
                       throws SQLException
Creates a dataset corresponding to the entire database.

Throws:
SQLException

createDataSet

IDataSet createDataSet(String[] tableNames)
                       throws SQLException,
                              DataSetException
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:
SQLException
DataSetException

createQueryTable

ITable createQueryTable(String tableName,
                        String sql)
                        throws DataSetException,
                               SQLException
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 by ITableMetaData.getTableName().
sql - The SQL SELECT statement
Returns:
The new table
Throws:
DataSetException
SQLException

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 by ITableMetaData.getTableName().
preparedStatement - The statement to be executed as query
Returns:
The new table
Throws:
DataSetException
SQLException
Since:
2.4.4

createTable

ITable createTable(String tableName)
                   throws DataSetException,
                          SQLException
Creates a table with the result of a select * from tableName SQL statement.

Parameters:
tableName - The name of the database table to be queried which is also returned by ITableMetaData.getTableName().
Throws:
DataSetException
SQLException

getRowCount

int getRowCount(String tableName)
                throws SQLException
Returns the specified table row count.

Parameters:
tableName - the table name
Returns:
the row count
Throws:
SQLException

getRowCount

int getRowCount(String tableName,
                String whereClause)
                throws SQLException
Returns the specified table row count according specified where clause.

Parameters:
tableName - the table name
whereClause - the where clause
Returns:
the row count
Throws:
SQLException

getConfig

DatabaseConfig getConfig()
Returns this connection database configuration


getStatementFactory

IStatementFactory getStatementFactory()
Deprecated. Use getConfig()



Copyright © 2002-2012. All Rights Reserved.