org.dbunit.database
Interface IDatabaseConnection

All Known Implementing Classes:
AbstractDatabaseConnection, DatabaseConnection, DatabaseDataSourceConnection

public interface IDatabaseConnection

This interface represents a connection to a specific database.

Since:
Mar 6, 2002
Version:
$Revision: 1.15 $
Author:
Manuel Laflamme

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

Method Detail

getConnection

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

Throws:
java.sql.SQLException

getSchema

public java.lang.String getSchema()
Returns the database schema name.


close

public void close()
           throws java.sql.SQLException
Close this connection.

Throws:
java.sql.SQLException

createDataSet

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

Throws:
java.sql.SQLException

createDataSet

public IDataSet createDataSet(java.lang.String[] tableNames)
                       throws java.sql.SQLException
Creates a dataset containing only the specified tables from the database.

Throws:
java.sql.SQLException

createQueryTable

public ITable createQueryTable(java.lang.String resultName,
                               java.lang.String sql)
                        throws DataSetException,
                               java.sql.SQLException
Creates a table with the result of the specified SQL statement. The table can be the result of a join statement.

Parameters:
resultName - The name to be returned by ITableMetaData.getTableName().
sql - The SQL SELECT statement
Throws:
DataSetException
java.sql.SQLException

getRowCount

public int getRowCount(java.lang.String tableName)
                throws java.sql.SQLException
Returns the specified table row count.

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

getRowCount

public int getRowCount(java.lang.String tableName,
                       java.lang.String whereClause)
                throws java.sql.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:
java.sql.SQLException

getConfig

public DatabaseConfig getConfig()
Returns this connection database configuration


getStatementFactory

public IStatementFactory getStatementFactory()
Deprecated. Use getConfig()



Copyright © 2002-2004 DbUnit.org. All Rights Reserved.