Class DatabaseDataSourceConnection

java.lang.Object
org.dbunit.database.AbstractDatabaseConnection
org.dbunit.database.DatabaseDataSourceConnection
All Implemented Interfaces:
IDatabaseConnection

public class DatabaseDataSourceConnection extends AbstractDatabaseConnection implements IDatabaseConnection
This class adapts a JDBC DataSource to a IDatabaseConnection.
Since:
Mar 8, 2002
Version:
$Revision$
Author:
Manuel Laflamme
  • Constructor Details

    • DatabaseDataSourceConnection

      public DatabaseDataSourceConnection(InitialContext context, String jndiName, String schema) throws NamingException, SQLException
      Creates a connection using the data source bound at the given JNDI name, in the given schema.
      Parameters:
      context - the JNDI context to look up the data source in.
      jndiName - the JNDI name the data source is bound at.
      schema - the database schema.
      Throws:
      NamingException - if the JNDI lookup fails.
      SQLException - if a database access error occurs.
    • DatabaseDataSourceConnection

      public DatabaseDataSourceConnection(InitialContext context, String jndiName, String schema, String user, String password) throws NamingException, SQLException
      Creates a connection using the data source bound at the given JNDI name, in the given schema, authenticating with the given credentials.
      Parameters:
      context - the JNDI context to look up the data source in.
      jndiName - the JNDI name the data source is bound at.
      schema - the database schema.
      user - the database user.
      password - the database password.
      Throws:
      NamingException - if the JNDI lookup fails.
      SQLException - if a database access error occurs.
    • DatabaseDataSourceConnection

      public DatabaseDataSourceConnection(InitialContext context, String jndiName) throws NamingException, SQLException
      Creates a connection using the data source bound at the given JNDI name.
      Parameters:
      context - the JNDI context to look up the data source in.
      jndiName - the JNDI name the data source is bound at.
      Throws:
      NamingException - if the JNDI lookup fails.
      SQLException - if a database access error occurs.
    • DatabaseDataSourceConnection

      public DatabaseDataSourceConnection(InitialContext context, String jndiName, String user, String password) throws NamingException, SQLException
      Creates a connection using the data source bound at the given JNDI name, authenticating with the given credentials.
      Parameters:
      context - the JNDI context to look up the data source in.
      jndiName - the JNDI name the data source is bound at.
      user - the database user.
      password - the database password.
      Throws:
      NamingException - if the JNDI lookup fails.
      SQLException - if a database access error occurs.
    • DatabaseDataSourceConnection

      public DatabaseDataSourceConnection(DataSource dataSource) throws SQLException
      Creates a connection using the given data source.
      Parameters:
      dataSource - the data source to adapt.
      Throws:
      SQLException - if a database access error occurs.
    • DatabaseDataSourceConnection

      public DatabaseDataSourceConnection(DataSource dataSource, String user, String password) throws SQLException
      Creates a connection using the given data source, authenticating with the given credentials.
      Parameters:
      dataSource - the data source to adapt.
      user - the database user.
      password - the database password.
      Throws:
      SQLException - if a database access error occurs.
    • DatabaseDataSourceConnection

      public DatabaseDataSourceConnection(DataSource dataSource, String schema) throws SQLException
      Creates a connection using the given data source, in the given schema.
      Parameters:
      dataSource - the data source to adapt.
      schema - the database schema.
      Throws:
      SQLException - if a database access error occurs.
    • DatabaseDataSourceConnection

      public DatabaseDataSourceConnection(DataSource dataSource, String schema, String user, String password) throws SQLException
      Creates a connection using the given data source, in the given schema, authenticating with the given credentials.
      Parameters:
      dataSource - the data source to adapt.
      schema - the database schema.
      user - the database user.
      password - the database password.
      Throws:
      SQLException - if a database access error occurs.
  • Method Details