com.ibm.jtopenlite.database.jdbc
Class JDBCConnection

java.lang.Object
  extended by com.ibm.jtopenlite.database.jdbc.JDBCConnection
All Implemented Interfaces:
DatabaseWarningCallback, Connection

public class JDBCConnection
extends Object
implements Connection, DatabaseWarningCallback

The JDBCConnection class provides a JDBC connection to a specific DB2 for IBM i database. Use DriverManager.getConnection() with a jdbc:jtopenlite://SYSTENAME URL to create AS400JDBCConnection objects.


Field Summary
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Method Summary
 void clearWarnings()
           
 void close()
           
 void commit()
          Commit the current transaction.
 Array createArrayOf(String arg0, Object[] arg1)
           
 Blob createBlob()
           
 Clob createClob()
           
 Statement createStatement()
           
 Statement createStatement(int resultSetType, int resultSetConcurrency)
          Only valid for ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY.
 Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          Only valid for ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, and ResultSet.HOLD_CURSORS_OVER_COMMIT.
 Struct createStruct(String arg0, Object[] arg1)
           
 boolean getAutoCommit()
          Return the autocommit setting.
 String getCatalog()
          Not implemented.
 Properties getClientInfo()
           
 String getClientInfo(String arg0)
           
static JDBCConnection getConnection(String system, String user, String password, boolean debug)
           
 int getHoldability()
          The holdability is always ResultSet.HOLD_CURSORS_OVER_COMMIT.
 DatabaseMetaData getMetaData()
          Returns the metadata for this connection.
 String getServerJobIdentifier()
           
protected  int getServerVersion()
          Return the version level.
 int getTransactionIsolation()
          Not implemented.
 Map getTypeMap()
          Not implemented.
 String getURL()
           
 String getUserName()
           
 SQLWarning getWarnings()
          Returns null because get warnings is not implemented on this driver.
 boolean isClosed()
           
 boolean isReadOnly()
          The driver does not allow readonly to be specified.
 boolean isValid(int arg0)
           
 String nativeSQL(String sql)
          Not implemented.
 void newMessageID(String id)
           
 void newMessageText(String text)
           
 void newSecondLevelText(String text)
           
 void newWarning(int rcClass, int rcClassReturnCode)
           
 void noWarnings()
           
 CallableStatement prepareCall(String sql)
           
 CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency)
           
 CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
 PreparedStatement prepareStatement(String sql)
           
 PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
           
 PreparedStatement prepareStatement(String sql, int[] columnIndices)
          Not implemented.
 PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
          Only implemented for ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY.
 PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          Only implemented for ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY and ResultSet.HOLD_CURSORS_OVER_COMMIT.
 PreparedStatement prepareStatement(String sql, String[] columnNames)
          Not implemented.
 void releaseSavepoint(Savepoint savepoint)
          Not implemented.
 void rollback()
          Rollback the current transaction.
 void rollback(Savepoint savepoint)
          Not implemented.
 void setAutoCommit(boolean autoCommit)
          Set the autocommit level.
 void setCatalog(String catalog)
          Not implemented.
 void setHoldability(int holdability)
          The only allowed holdability is to hold cursors over commit.
 void setReadOnly(boolean readOnly)
          The default setting if false.
 Savepoint setSavepoint()
          Not implemented.
 Savepoint setSavepoint(String name)
          Not implemented.
 void setTransactionIsolation(int level)
          sets the isolation level used by the connection.
 void setTypeMap(Map map)
          Not implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newWarning

public void newWarning(int rcClass,
                       int rcClassReturnCode)
Specified by:
newWarning in interface DatabaseWarningCallback

noWarnings

public void noWarnings()
Specified by:
noWarnings in interface DatabaseWarningCallback

newMessageID

public void newMessageID(String id)
Specified by:
newMessageID in interface DatabaseWarningCallback

newMessageText

public void newMessageText(String text)
Specified by:
newMessageText in interface DatabaseWarningCallback

newSecondLevelText

public void newSecondLevelText(String text)
Specified by:
newSecondLevelText in interface DatabaseWarningCallback

getConnection

public static JDBCConnection getConnection(String system,
                                           String user,
                                           String password,
                                           boolean debug)
                                    throws SQLException
Throws:
SQLException

clearWarnings

public void clearWarnings()
                   throws SQLException
Specified by:
clearWarnings in interface Connection
Throws:
SQLException

close

public void close()
           throws SQLException
Specified by:
close in interface Connection
Throws:
SQLException

commit

public void commit()
            throws SQLException
Commit the current transaction.

Specified by:
commit in interface Connection
Throws:
SQLException

createStatement

public Statement createStatement()
                          throws SQLException
Specified by:
createStatement in interface Connection
Throws:
SQLException

createStatement

public Statement createStatement(int resultSetType,
                                 int resultSetConcurrency)
                          throws SQLException
Only valid for ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY.

Specified by:
createStatement in interface Connection
Throws:
SQLException

createStatement

public Statement createStatement(int resultSetType,
                                 int resultSetConcurrency,
                                 int resultSetHoldability)
                          throws SQLException
Only valid for ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, and ResultSet.HOLD_CURSORS_OVER_COMMIT.

Specified by:
createStatement in interface Connection
Throws:
SQLException

getAutoCommit

public boolean getAutoCommit()
                      throws SQLException
Return the autocommit setting.

Specified by:
getAutoCommit in interface Connection
Throws:
SQLException

getCatalog

public String getCatalog()
                  throws SQLException
Not implemented.

Specified by:
getCatalog in interface Connection
Throws:
SQLException

getHoldability

public int getHoldability()
                   throws SQLException
The holdability is always ResultSet.HOLD_CURSORS_OVER_COMMIT.

Specified by:
getHoldability in interface Connection
Throws:
SQLException

getMetaData

public DatabaseMetaData getMetaData()
                             throws SQLException
Returns the metadata for this connection.

Specified by:
getMetaData in interface Connection
Throws:
SQLException

getTransactionIsolation

public int getTransactionIsolation()
                            throws SQLException
Not implemented.

Specified by:
getTransactionIsolation in interface Connection
Throws:
SQLException

getTypeMap

public Map getTypeMap()
               throws SQLException
Not implemented.

Specified by:
getTypeMap in interface Connection
Throws:
SQLException

getWarnings

public SQLWarning getWarnings()
                       throws SQLException
Returns null because get warnings is not implemented on this driver.

Specified by:
getWarnings in interface Connection
Throws:
SQLException

isClosed

public boolean isClosed()
                 throws SQLException
Specified by:
isClosed in interface Connection
Throws:
SQLException

isReadOnly

public boolean isReadOnly()
                   throws SQLException
The driver does not allow readonly to be specified. All connections will allow writes to be done.

Specified by:
isReadOnly in interface Connection
Throws:
SQLException

nativeSQL

public String nativeSQL(String sql)
                 throws SQLException
Not implemented.

Specified by:
nativeSQL in interface Connection
Throws:
SQLException

prepareCall

public CallableStatement prepareCall(String sql)
                              throws SQLException
Specified by:
prepareCall in interface Connection
Throws:
SQLException

prepareCall

public CallableStatement prepareCall(String sql,
                                     int resultSetType,
                                     int resultSetConcurrency)
                              throws SQLException
Specified by:
prepareCall in interface Connection
Throws:
SQLException

prepareCall

public CallableStatement prepareCall(String sql,
                                     int resultSetType,
                                     int resultSetConcurrency,
                                     int resultSetHoldability)
                              throws SQLException
Specified by:
prepareCall in interface Connection
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql)
                                   throws SQLException
Specified by:
prepareStatement in interface Connection
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int autoGeneratedKeys)
                                   throws SQLException
Specified by:
prepareStatement in interface Connection
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int[] columnIndices)
                                   throws SQLException
Not implemented.

Specified by:
prepareStatement in interface Connection
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency)
                                   throws SQLException
Only implemented for ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY.

Specified by:
prepareStatement in interface Connection
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency,
                                          int resultSetHoldability)
                                   throws SQLException
Only implemented for ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY and ResultSet.HOLD_CURSORS_OVER_COMMIT.

Specified by:
prepareStatement in interface Connection
Throws:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          String[] columnNames)
                                   throws SQLException
Not implemented.

Specified by:
prepareStatement in interface Connection
Throws:
SQLException

releaseSavepoint

public void releaseSavepoint(Savepoint savepoint)
                      throws SQLException
Not implemented.

Specified by:
releaseSavepoint in interface Connection
Throws:
SQLException

rollback

public void rollback()
              throws SQLException
Rollback the current transaction.

Specified by:
rollback in interface Connection
Throws:
SQLException

rollback

public void rollback(Savepoint savepoint)
              throws SQLException
Not implemented.

Specified by:
rollback in interface Connection
Throws:
SQLException

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws SQLException
Set the autocommit level.

Specified by:
setAutoCommit in interface Connection
Throws:
SQLException

setCatalog

public void setCatalog(String catalog)
                throws SQLException
Not implemented.

Specified by:
setCatalog in interface Connection
Throws:
SQLException

setHoldability

public void setHoldability(int holdability)
                    throws SQLException
The only allowed holdability is to hold cursors over commit.

Specified by:
setHoldability in interface Connection
Throws:
SQLException

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws SQLException
The default setting if false. Any attempt to change the value to true will result in a NotImplementedException.

Specified by:
setReadOnly in interface Connection
Throws:
SQLException

setSavepoint

public Savepoint setSavepoint()
                       throws SQLException
Not implemented.

Specified by:
setSavepoint in interface Connection
Throws:
SQLException

setSavepoint

public Savepoint setSavepoint(String name)
                       throws SQLException
Not implemented.

Specified by:
setSavepoint in interface Connection
Throws:
SQLException

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws SQLException
sets the isolation level used by the connection.

Specified by:
setTransactionIsolation in interface Connection
Throws:
SQLException

setTypeMap

public void setTypeMap(Map map)
                throws SQLException
Not implemented.

Specified by:
setTypeMap in interface Connection
Throws:
SQLException

getServerVersion

protected int getServerVersion()
                        throws SQLException
Return the version level. See SystemInfo.VERSION_VxRx constants for possible values.

Returns:
Throws:
SQLException

getUserName

public String getUserName()
                   throws SQLException
Throws:
SQLException

getURL

public String getURL()
              throws SQLException
Throws:
SQLException

getServerJobIdentifier

public String getServerJobIdentifier()

createArrayOf

public Array createArrayOf(String arg0,
                           Object[] arg1)
                    throws SQLException
Throws:
SQLException

createBlob

public Blob createBlob()
                throws SQLException
Throws:
SQLException

createClob

public Clob createClob()
                throws SQLException
Throws:
SQLException

createStruct

public Struct createStruct(String arg0,
                           Object[] arg1)
                    throws SQLException
Parameters:
arg0 -
arg1 -
Throws:
SQLException

getClientInfo

public Properties getClientInfo()
                         throws SQLException
Throws:
SQLException

getClientInfo

public String getClientInfo(String arg0)
                     throws SQLException
Parameters:
arg0 -
Throws:
SQLException

isValid

public boolean isValid(int arg0)
                throws SQLException
Parameters:
arg0 -
Throws:
SQLException