superwaba.ext.xplat.sql
Class Connection

java.lang.Object
  |
  +--superwaba.ext.xplat.sql.Connection
Direct Known Subclasses:
Db2eConnection

public abstract class Connection
extends Object

This interface provides methods for managing a connection to a database.


Field Summary
static int TRANSACTION_NONE
          This transaction isolation level indicates that transactions are not supported.
static int TRANSACTION_READ_COMMITTED
          This transaction isolation leve indicates that only committed data from other transactions will be read.
static int TRANSACTION_READ_UNCOMMITTED
          This transaction isolation level indicates that one transaction can read modifications by other transactions before the other transactions have committed their changes.
static int TRANSACTION_REPEATABLE_READ
          This transaction isolation level indicates that only committed data from other transactions will be read.
static int TRANSACTION_SERIALIZABLE
          This transaction isolation level indicates that only committed data from other transactions will be read.
 
Constructor Summary
Connection()
           
 
Method Summary
abstract  void clearWarnings()
          This method clears all warnings that have occurred on this connection.
abstract  void close()
          This method immediately closes this database connection.
abstract  void commit()
          This method commits any SQL statements executed on this connection since the last commit or rollback.
abstract  Statement createStatement()
          This method creates a new SQL statement.
abstract  Statement createStatement(int resultSetType, int resultSetConcurrency)
          This method creates a new SQL statement with the specified type and concurrency.
abstract  boolean getAutoCommit()
          This method tests whether or not auto commit mode is currently enabled.
abstract  String getCatalog()
          This method returns the name of the catalog in use by this connection, if any.
abstract  DatabaseMetaData getMetaData()
          This method returns the meta data for this database connection.
abstract  int getTransactionIsolation()
          This method returns the current transaction isolation mode.
abstract  SQLWarning getWarnings()
          This method returns the first warning that occurred on this connection, if any.
abstract  boolean isClosed()
          This method tests whether or not this connection has been closed.
abstract  PreparedStatement prepareStatement(String sql)
          This method creates a new PreparedStatement for the specified SQL string.
abstract  PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
          This method creates a new PreparedStatement for the specified SQL string.
abstract  void rollback()
          This method rolls back any SQL statements executed on this connection since the last commit or rollback.
abstract  void setAutoCommit(boolean autoCommit)
          This method turns auto commit mode on or off.
abstract  void setCatalog(String catalog)
          This method sets the name of the catalog in use by this connection.
abstract  void setTransactionIsolation(int level)
          This method sets the current transaction isolation mode.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Field Detail

TRANSACTION_NONE

public static final int TRANSACTION_NONE
This transaction isolation level indicates that transactions are not supported.

TRANSACTION_READ_UNCOMMITTED

public static final int TRANSACTION_READ_UNCOMMITTED
This transaction isolation level indicates that one transaction can read modifications by other transactions before the other transactions have committed their changes. This could result in invalid reads.

TRANSACTION_READ_COMMITTED

public static final int TRANSACTION_READ_COMMITTED
This transaction isolation leve indicates that only committed data from other transactions will be read. If a transaction reads a row, then another transaction commits a change to that row, the first transaction would retrieve the changed row on subsequent reads of the same row.

TRANSACTION_REPEATABLE_READ

public static final int TRANSACTION_REPEATABLE_READ
This transaction isolation level indicates that only committed data from other transactions will be read. It also ensures that data read from a row will not be different on a subsequent read even if another transaction commits a change.

TRANSACTION_SERIALIZABLE

public static final int TRANSACTION_SERIALIZABLE
This transaction isolation level indicates that only committed data from other transactions will be read. It also ensures that data read from a row will not be different on a subsequent read even if another transaction commits a change. Additionally, rows modified by other transactions will not affect the result set returned during subsequent executions of the same WHERE clause in this transaction.
Constructor Detail

Connection

public Connection()
Method Detail

createStatement

public abstract Statement createStatement()
                                   throws SQLException
This method creates a new SQL statement. The default result set type and concurrency will be used.
Returns:
A new Statement object.
Throws:
SQLException - If an error occurs.
See Also:
Statement

prepareStatement

public abstract PreparedStatement prepareStatement(String sql)
                                            throws SQLException
This method creates a new PreparedStatement for the specified SQL string. This method is designed for use with parameterized statements. The default result set type and concurrency will be used.
Parameters:
The - SQL statement to use in creating this PreparedStatement.
Returns:
A new PreparedStatement.
Throws:
SQLException - If an error occurs.
See Also:
PreparedStatement

setAutoCommit

public abstract void setAutoCommit(boolean autoCommit)
                            throws SQLException
This method turns auto commit mode on or off. In auto commit mode, every SQL statement is committed its own transaction. Otherwise a transaction must be explicitly committed or rolled back.
Parameters:
autoCommit - true to enable auto commit mode, false to disable it.
Throws:
SQLException - If an error occurs.
See Also:
commit(), rollback()

getAutoCommit

public abstract boolean getAutoCommit()
                               throws SQLException
This method tests whether or not auto commit mode is currently enabled. In auto commit mode, every SQL statement is committed its own transaction. Otherwise a transaction must be explicitly committed or rolled back.
Returns:
true if auto commit mode is enabled, false otherwise.
Throws:
SQLException - If an error occurs.
See Also:
commit(), rollback()

commit

public abstract void commit()
                     throws SQLException
This method commits any SQL statements executed on this connection since the last commit or rollback.
Throws:
SQLException - If an error occurs.

rollback

public abstract void rollback()
                       throws SQLException
This method rolls back any SQL statements executed on this connection since the last commit or rollback.
Throws:
SQLException - If an error occurs.

close

public abstract void close()
                    throws SQLException
This method immediately closes this database connection.
Throws:
SQLException - If an error occurs.

isClosed

public abstract boolean isClosed()
                          throws SQLException
This method tests whether or not this connection has been closed.
Returns:
true if the connection is closed, false otherwise.
Throws:
SQLException - If an error occurs.

getMetaData

public abstract DatabaseMetaData getMetaData()
                                      throws SQLException
This method returns the meta data for this database connection.
Returns:
The meta data for this database.
Throws:
SQLException - If an error occurs.
See Also:
DatabaseMetaData

setCatalog

public abstract void setCatalog(String catalog)
                         throws SQLException
This method sets the name of the catalog in use by this connection. Note that this method does nothing if catalogs are not supported by this database.
Parameters:
catalog - The name of the catalog to use for this connection.
Throws:
SQLException - If an error occurs.

getCatalog

public abstract String getCatalog()
                           throws SQLException
This method returns the name of the catalog in use by this connection, if any.
Returns:
The name of the catalog, or null if one does not exist or catalogs are not supported by this database.
Throws:
SQLException - If an error occurs.

setTransactionIsolation

public abstract void setTransactionIsolation(int level)
                                      throws SQLException
This method sets the current transaction isolation mode. This must be one of the constants defined in this interface.
Parameters:
level - The transaction isolation level.
Throws:
SQLException - If an error occurs.

getTransactionIsolation

public abstract int getTransactionIsolation()
                                     throws SQLException
This method returns the current transaction isolation mode. This will be one of the constants defined in this interface.
Returns:
The transaction isolation level.
Throws:
SQLException - If an error occurs.

getWarnings

public abstract SQLWarning getWarnings()
                                throws SQLException
This method returns the first warning that occurred on this connection, if any. If there were any subsequence warnings, they will be chained to the first one.
Returns:
The first SQLWarning that occurred, or null if there have been no warnings.
Throws:
SQLException - If an error occurs.

clearWarnings

public abstract void clearWarnings()
                            throws SQLException
This method clears all warnings that have occurred on this connection.
Throws:
SQLException - If an error occurs.

createStatement

public abstract Statement createStatement(int resultSetType,
                                          int resultSetConcurrency)
                                   throws SQLException
This method creates a new SQL statement with the specified type and concurrency. Valid values for these parameters are specified in the ResultSet class.
Parameters:
resultSetType - The type of result set to use for this statement.
resultSetConcurrency. - The type of concurrency to be used in the result set for this statement.
Returns:
A new Statement object.
Throws:
SQLException - If an error occurs.
See Also:
Statement, ResultSet

prepareStatement

public abstract PreparedStatement prepareStatement(String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency)
                                            throws SQLException
This method creates a new PreparedStatement for the specified SQL string. This method is designed for use with parameterized statements. The specified result set type and concurrency will be used. Valid values for these parameters are specified in the ResultSet class.
Parameters:
The - SQL statement to use in creating this PreparedStatement.
resultSetType - The type of result set to use for this statement.
resultSetConcurrency. - The type of concurrency to be used in the result set for this statement.
Returns:
A new PreparedStatement.
Throws:
SQLException - If an error occurs.
See Also:
PreparedStatement, ResultSet