BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.jdbc.informix4
Class BaseConnection

java.lang.Object
  |
  +--weblogic.jdbc.informix4.BaseHandler
        |
        +--weblogic.jdbc.informix4.BaseConnection

public abstract class BaseConnection
extends BaseHandler
implements java.sql.Connection

Author:
Copyright © 2001 BEA Systems, Inc. All Rights Reserved.

Field Summary
protected  boolean autocommit
           
protected  java.lang.String charset
           
protected  BaseDriver driver
           
protected  java.lang.String encoding
           
protected  ConnectionInfo info
           
protected  weblogic.jdbc.informix4.DatabaseMetaData metadata
           
protected  boolean readOnly
           
protected  SocketExtras socketExtras
           
 java.util.Hashtable stmtTable
           
protected  int transactionIsolation
           
 
Fields inherited from class weblogic.jdbc.informix4.BaseHandler
closed, kInformixProtocol, kMicrosoftProtocol, kOracleProtocol, kSybaseProtocol, kUnknownProtocol, unique, warnings
 
Constructor Summary
BaseConnection(BaseDriver driver, ConnectionInfo info)
          Initialize the connection to the host and database whose names are given in the iName parameter.
 
Method Summary
protected  java.lang.String charset2encoding(java.lang.String inCharset)
          Converts the name of an Informix charset into the equivalent JDK encoding.
 void close()
          In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released; the close method provides this immediate release.
 void commit()
          Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection.
protected  void commit(boolean commit)
           
 java.sql.Statement createStatement()
           
 boolean getAutoCommit()
          Get the current auto-commit state.
 java.lang.String getCatalog()
          Return the Connection's current catalog name
protected  java.lang.String getCharset()
           
protected  int getConnections()
          This method returns the number of concurrent connections to this database.
 java.lang.String getEncoding()
          Get the JDK Character Set Encoding that is used to talk to the DBMS
 ConnectionInfo getInfo()
           
 java.sql.DatabaseMetaData getMetaData()
          A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc.
protected  java.lang.String getProductCode()
           
 int getTransactionIsolation()
          Get this Connection's current transaction isolation mode
 boolean isReadOnly()
          Test if the connection is in read-only mode
protected  void login(BaseConnection connection, ConnectionInfo info)
           
 java.lang.String nativeSQL(java.lang.String sql)
          No SQL translation is necessary for this driver
 java.sql.CallableStatement prepareCall(java.lang.String sql)
          A SQL stored procedure call statement is handled by creating a CallableStatement for it.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
          A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object.
 void rollback()
          Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection.
 void setAutoCommit(boolean iAutoCommit)
          If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions.
 void setCatalog(java.lang.String catalog)
          A sub-space of this Connection's database may be selected by setting a catalog name.
 boolean setEncoding(java.lang.String inEncoding)
           
protected static void setProperties(java.util.Properties props)
           
 void setReadOnly(boolean readOnly)
          You can put a connection in read-only mode as a hint to enable database optimizations.
 void setTransactionIsolation(int jdbcLevel)
          You can call this method to try to change the transaction isolation level on a newly opened connection, using one of the TRANSACTION_* values.
 
Methods inherited from class weblogic.jdbc.informix4.BaseHandler
appendWarning, clearWarnings, complainIfClosed, finalize, getProtocol, getWarnings, isClosed, setProtocol
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stmtTable

public java.util.Hashtable stmtTable

driver

protected BaseDriver driver

metadata

protected weblogic.jdbc.informix4.DatabaseMetaData metadata

info

protected ConnectionInfo info

socketExtras

protected SocketExtras socketExtras

autocommit

protected boolean autocommit

readOnly

protected boolean readOnly

transactionIsolation

protected int transactionIsolation

charset

protected java.lang.String charset

encoding

protected java.lang.String encoding
Constructor Detail

BaseConnection

public BaseConnection(BaseDriver driver,
                      ConnectionInfo info)
               throws java.sql.SQLException
Initialize the connection to the host and database whose names are given in the iName parameter. Other properties, like login name, password, etc, are also specified in iName. The method will raise a SQLException if the host can't be found or the connection can't be established for some other reason (eg. wrong password).

Parameters:
iName - Information on target host, database, port, password, etc.
Method Detail

setProperties

protected static void setProperties(java.util.Properties props)


login

protected void login(BaseConnection connection,
                     ConnectionInfo info)
              throws java.sql.SQLException


getConnections

protected int getConnections()
This method returns the number of concurrent connections to this database. The way we calculate this is database specific. The particular method used here works on both Sybase SQL Server and Microsoft SQL Server. There could be particular situations under which this does not work in which case we'll just return 0 as the number of concurrent clients (0 means, could not be checked).


getProductCode

protected java.lang.String getProductCode()


createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
Specified by:
createStatement in interface java.sql.Connection


prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, prepareStatement will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement is executed. This has no direct affect on users; however, it does affect which method throws certain SQLExceptions.

Specified by:
prepareStatement in interface java.sql.Connection

Parameters:
sql - a SQL statement that may contain one or more '?' IN parameter placeholders
Returns:
a new PreparedStatement object containing the pre-compiled statement

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException
A SQL stored procedure call statement is handled by creating a CallableStatement for it. The CallableStatement provides methods for setting up its IN and OUT parameters, and methods for executing it.

Note: This method is optimized for handling stored procedure call statements. Some drivers may send the call statement to the database when the prepareCall is done; others may wait until the CallableStatement is executed. This has no direct affect on users; however, it does affect which method throws certain SQLExceptions.

Specified by:
prepareCall in interface java.sql.Connection

Parameters:
sql - a SQL statement that may contain one or more '?' parameter placeholders
Returns:
a new CallableStatement object containing the pre-compiled SQL statement

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
No SQL translation is necessary for this driver
Specified by:
nativeSQL in interface java.sql.Connection


setAutoCommit

public void setAutoCommit(boolean iAutoCommit)
                   throws java.sql.SQLException
If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by either commit() or rollback(). By default, new connections are in auto-commit mode. The commit occurs when the statement completes or the next execute occurs, whichever comes first. In the case of statements returning a ResultSet, the statement completes when the last row of the ResultSet has been retrieved or the ResultSet has been closed. In advanced cases, a single statement may return multiple results as well as output parameter values. Here the commit occurs when all results and output param values have been retrieved.
Specified by:
setAutoCommit in interface java.sql.Connection

Parameters:
autoCommit - true enables auto-commit; false disables auto-commit.
See Also:
Connection.setAutoCommit(boolean)

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException
Get the current auto-commit state.
Specified by:
getAutoCommit in interface java.sql.Connection

Returns:
Current state of auto-commit mode.
See Also:
setAutoCommit(boolean)

commit

public void commit()
            throws java.sql.SQLException
Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection.

Note: By default, a Connection's PreparedStatements, CallableStatements and ResultSets are implicitly closed when it is committed.

Specified by:
commit in interface java.sql.Connection

See Also:
setAutoCommit(boolean)

commit

protected void commit(boolean commit)
               throws java.sql.SQLException


rollback

public void rollback()
              throws java.sql.SQLException
Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection.

Note: By default, a Connection's PreparedStatements, CallableStatements and ResultSets are implicitly closed when it is committed.

Specified by:
rollback in interface java.sql.Connection

See Also:
setAutoCommit(boolean)

setTransactionIsolation

public void setTransactionIsolation(int jdbcLevel)
                             throws java.sql.SQLException
You can call this method to try to change the transaction isolation level on a newly opened connection, using one of the TRANSACTION_* values.

Note: setTransactionIsolation cannot be called while in the middle of a transaction.

Specified by:
setTransactionIsolation in interface java.sql.Connection

Parameters:
level - one of the TRANSACTION_* isolation values with the exception of TRANSACTION_NONE; some databases may not support other values
See Also:
DatabaseMetaData.supportsTransactionIsolationLevel(int)

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException
Get this Connection's current transaction isolation mode
Specified by:
getTransactionIsolation in interface java.sql.Connection

Returns:
the current TRANSACTION_* mode value

close

public void close()
           throws java.sql.SQLException
In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released; the close method provides this immediate release.

Note: A Connection is automatically closed when it is garbage collected. Certain fatal errors also result in a closed Connection.

Specified by:
close in interface java.sql.Connection

Overrides:
close in class BaseHandler

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. This information is made available through a DatabaseMetaData object.
Specified by:
getMetaData in interface java.sql.Connection

Returns:
a DatabaseMetaData object for this Connection

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws java.sql.SQLException
You can put a connection in read-only mode as a hint to enable database optimizations.

Note: setReadOnly cannot be called while in the middle of a transaction.

Specified by:
setReadOnly in interface java.sql.Connection

Parameters:
readOnly - true enables read-only mode; false disables read-only mode.

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException
Test if the connection is in read-only mode
Specified by:
isReadOnly in interface java.sql.Connection

Returns:
true if connection is read-only

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException
A sub-space of this Connection's database may be selected by setting a catalog name. If the driver does not support catalogs it will silently ignore this request.
Specified by:
setCatalog in interface java.sql.Connection


getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
Return the Connection's current catalog name
Specified by:
getCatalog in interface java.sql.Connection

Returns:
the current catalog name or null

getInfo

public ConnectionInfo getInfo()


getCharset

protected java.lang.String getCharset()


getEncoding

public java.lang.String getEncoding()
Get the JDK Character Set Encoding that is used to talk to the DBMS


charset2encoding

protected java.lang.String charset2encoding(java.lang.String inCharset)
Converts the name of an Informix charset into the equivalent JDK encoding.


setEncoding

public boolean setEncoding(java.lang.String inEncoding)
                    throws java.sql.SQLException


Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs61

WebLogic classes and methods that do not appear in this reference are not public and are not supported.