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 Details

    • getConnection

      Connection getConnection() throws SQLException
      Returns a JDBC database connection.
      Returns:
      the underlying JDBC connection.
      Throws:
      SQLException - if a database access error occurs.
    • getSchema

      String getSchema()
      Returns the database schema name.
      Returns:
      the schema name, or null if none is set.
    • close

      void close() throws SQLException
      Close this connection.
      Throws:
      SQLException - if a database access error occurs.
    • createDataSet

      IDataSet createDataSet() throws SQLException
      Creates a dataset corresponding to the entire database.
      Returns:
      the new dataset.
      Throws:
      SQLException - if a database access error occurs.
    • 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 - if a database access error occurs.
      DataSetException - if a table in tableNames does not exist in the database.
    • 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 - if an error occurs building the table's metadata.
      SQLException - if a database access error occurs.
    • 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 - if an error occurs building the table's metadata.
      SQLException - if a database access error occurs.
      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().
      Returns:
      The new table.
      Throws:
      DataSetException - if an error occurs building the table's metadata.
      SQLException - if a database access error occurs.
    • getRowCount

      int getRowCount(String tableName) throws SQLException
      Returns the specified table row count.
      Parameters:
      tableName - the table name
      Returns:
      the row count
      Throws:
      SQLException - if a database access error occurs.
    • 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 - if a database access error occurs.
    • getConfig

      DatabaseConfig getConfig()
      Returns this connection database configuration
      Returns:
      this connection's DatabaseConfig.
    • getStatementFactory

      IStatementFactory getStatementFactory()
      Deprecated.
      Returns the statement factory configured on this connection.
      Returns:
      this connection's IStatementFactory.