com.ibm.jtopenlite.database.jdbc

Class JDBCConnection

  • java.lang.Object
    • com.ibm.jtopenlite.database.jdbc.JDBCConnection
  • All Implemented Interfaces:
    DatabaseWarningCallback, java.sql.Connection, java.sql.Wrapper


    public class JDBCConnection
    extends java.lang.Object
    implements java.sql.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

      Methods 
      Modifier and Type Method and Description
      void clearWarnings() 
      void close() 
      void commit()
      Commit the current transaction.
      java.sql.Array createArrayOf(java.lang.String arg0, java.lang.Object[] arg1) 
      java.sql.Blob createBlob() 
      java.sql.Clob createClob() 
      java.sql.Statement createStatement() 
      java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
      Only valid for ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY.
      java.sql.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.
      java.sql.Struct createStruct(java.lang.String arg0, java.lang.Object[] arg1) 
      boolean getAutoCommit()
      Return the autocommit setting.
      java.lang.String getCatalog()
      Not implemented.
      java.util.Properties getClientInfo() 
      java.lang.String getClientInfo(java.lang.String arg0) 
      static JDBCConnection getConnection(boolean isSSL, java.lang.String system, java.lang.String user, java.lang.String password, boolean debug) 
      static JDBCConnection getConnection(java.lang.String system, java.lang.String user, java.lang.String password, boolean debug) 
      int getHoldability()
      The holdability is always ResultSet.HOLD_CURSORS_OVER_COMMIT.
      java.sql.DatabaseMetaData getMetaData()
      Returns the metadata for this connection.
      java.lang.String getServerJobIdentifier() 
      protected int getServerVersion()
      Return the version level.
      int getTransactionIsolation()
      Not implemented.
      java.util.Map getTypeMap()
      Not implemented.
      java.lang.String getURL() 
      java.lang.String getUserName() 
      java.sql.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) 
      java.lang.String nativeSQL(java.lang.String sql)
      Not implemented.
      void newMessageID(java.lang.String id) 
      void newMessageText(java.lang.String text) 
      void newSecondLevelText(java.lang.String text) 
      void newWarning(int rcClass, int rcClassReturnCode) 
      void noWarnings() 
      java.sql.CallableStatement prepareCall(java.lang.String sql) 
      java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) 
      java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) 
      java.sql.PreparedStatement prepareStatement(java.lang.String sql) 
      java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) 
      java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndices)
      Not implemented.
      java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
      Only implemented for ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY.
      java.sql.PreparedStatement prepareStatement(java.lang.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.
      java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames)
      Not implemented.
      void releaseSavepoint(java.sql.Savepoint savepoint)
      Not implemented.
      void rollback()
      Rollback the current transaction.
      void rollback(java.sql.Savepoint savepoint)
      Not implemented.
      void setAutoCommit(boolean autoCommit)
      Set the autocommit level.
      void setCatalog(java.lang.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.
      java.sql.Savepoint setSavepoint()
      Not implemented.
      java.sql.Savepoint setSavepoint(java.lang.String name)
      Not implemented.
      void setTransactionIsolation(int level)
      sets the isolation level used by the connection.
      void setTypeMap(java.util.Map map)
      Not implemented.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.sql.Connection

        createNClob, createSQLXML, setClientInfo, setClientInfo
      • Methods inherited from interface java.sql.Wrapper

        isWrapperFor, unwrap
    • Method Detail

      • getConnection

        public static JDBCConnection getConnection(java.lang.String system,
                                   java.lang.String user,
                                   java.lang.String password,
                                   boolean debug)
                                            throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getConnection

        public static JDBCConnection getConnection(boolean isSSL,
                                   java.lang.String system,
                                   java.lang.String user,
                                   java.lang.String password,
                                   boolean debug)
                                            throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • clearWarnings

        public void clearWarnings()
                           throws java.sql.SQLException
        Specified by:
        clearWarnings in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • close

        public void close()
                   throws java.sql.SQLException
        Specified by:
        close in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • commit

        public void commit()
                    throws java.sql.SQLException
        Commit the current transaction.
        Specified by:
        commit in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • createStatement

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

        public java.sql.Statement createStatement(int resultSetType,
                                         int resultSetConcurrency)
                                           throws java.sql.SQLException
        Only valid for ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY.
        Specified by:
        createStatement in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • createStatement

        public java.sql.Statement createStatement(int resultSetType,
                                         int resultSetConcurrency,
                                         int resultSetHoldability)
                                           throws java.sql.SQLException
        Only valid for ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, and ResultSet.HOLD_CURSORS_OVER_COMMIT.
        Specified by:
        createStatement in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • getAutoCommit

        public boolean getAutoCommit()
                              throws java.sql.SQLException
        Return the autocommit setting.
        Specified by:
        getAutoCommit in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • getCatalog

        public java.lang.String getCatalog()
                                    throws java.sql.SQLException
        Not implemented.
        Specified by:
        getCatalog in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • getHoldability

        public int getHoldability()
                           throws java.sql.SQLException
        The holdability is always ResultSet.HOLD_CURSORS_OVER_COMMIT.
        Specified by:
        getHoldability in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • getMetaData

        public java.sql.DatabaseMetaData getMetaData()
                                              throws java.sql.SQLException
        Returns the metadata for this connection.
        Specified by:
        getMetaData in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • getTransactionIsolation

        public int getTransactionIsolation()
                                    throws java.sql.SQLException
        Not implemented.
        Specified by:
        getTransactionIsolation in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • getTypeMap

        public java.util.Map getTypeMap()
                                 throws java.sql.SQLException
        Not implemented.
        Specified by:
        getTypeMap in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • getWarnings

        public java.sql.SQLWarning getWarnings()
                                        throws java.sql.SQLException
        Returns null because get warnings is not implemented on this driver.
        Specified by:
        getWarnings in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • isClosed

        public boolean isClosed()
                         throws java.sql.SQLException
        Specified by:
        isClosed in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • isReadOnly

        public boolean isReadOnly()
                           throws java.sql.SQLException
        The driver does not allow readonly to be specified. All connections will allow writes to be done.
        Specified by:
        isReadOnly in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • nativeSQL

        public java.lang.String nativeSQL(java.lang.String sql)
                                   throws java.sql.SQLException
        Not implemented.
        Specified by:
        nativeSQL in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • prepareCall

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

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

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

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

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

        public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                  int[] columnIndices)
                                                    throws java.sql.SQLException
        Not implemented.
        Specified by:
        prepareStatement in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                  int resultSetType,
                                                  int resultSetConcurrency)
                                                    throws java.sql.SQLException
        Only implemented for ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY.
        Specified by:
        prepareStatement in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                  int resultSetType,
                                                  int resultSetConcurrency,
                                                  int resultSetHoldability)
                                                    throws java.sql.SQLException
        Only implemented for ResultSet.TYPE_FORWARD_ONLY and ResultSet.CONCUR_READ_ONLY and ResultSet.HOLD_CURSORS_OVER_COMMIT.
        Specified by:
        prepareStatement in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                  java.lang.String[] columnNames)
                                                    throws java.sql.SQLException
        Not implemented.
        Specified by:
        prepareStatement in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • releaseSavepoint

        public void releaseSavepoint(java.sql.Savepoint savepoint)
                              throws java.sql.SQLException
        Not implemented.
        Specified by:
        releaseSavepoint in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • rollback

        public void rollback()
                      throws java.sql.SQLException
        Rollback the current transaction.
        Specified by:
        rollback in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • rollback

        public void rollback(java.sql.Savepoint savepoint)
                      throws java.sql.SQLException
        Not implemented.
        Specified by:
        rollback in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • setAutoCommit

        public void setAutoCommit(boolean autoCommit)
                           throws java.sql.SQLException
        Set the autocommit level.
        Specified by:
        setAutoCommit in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • setCatalog

        public void setCatalog(java.lang.String catalog)
                        throws java.sql.SQLException
        Not implemented.
        Specified by:
        setCatalog in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • setHoldability

        public void setHoldability(int holdability)
                            throws java.sql.SQLException
        The only allowed holdability is to hold cursors over commit.
        Specified by:
        setHoldability in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • setReadOnly

        public void setReadOnly(boolean readOnly)
                         throws java.sql.SQLException
        The default setting if false. Any attempt to change the value to true will result in a NotImplementedException.
        Specified by:
        setReadOnly in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • setSavepoint

        public java.sql.Savepoint setSavepoint()
                                        throws java.sql.SQLException
        Not implemented.
        Specified by:
        setSavepoint in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • setSavepoint

        public java.sql.Savepoint setSavepoint(java.lang.String name)
                                        throws java.sql.SQLException
        Not implemented.
        Specified by:
        setSavepoint in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • setTransactionIsolation

        public void setTransactionIsolation(int level)
                                     throws java.sql.SQLException
        sets the isolation level used by the connection.
        Specified by:
        setTransactionIsolation in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • setTypeMap

        public void setTypeMap(java.util.Map map)
                        throws java.sql.SQLException
        Not implemented.
        Specified by:
        setTypeMap in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • getServerVersion

        protected int getServerVersion()
                                throws java.sql.SQLException
        Return the version level. See SystemInfo.VERSION_VxRx constants for possible values.
        Returns:
        the version level of the server
        Throws:
        java.sql.SQLException
      • getUserName

        public java.lang.String getUserName()
                                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getURL

        public java.lang.String getURL()
                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getServerJobIdentifier

        public java.lang.String getServerJobIdentifier()
      • createArrayOf

        public java.sql.Array createArrayOf(java.lang.String arg0,
                                   java.lang.Object[] arg1)
                                     throws java.sql.SQLException
        Specified by:
        createArrayOf in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • createBlob

        public java.sql.Blob createBlob()
                                 throws java.sql.SQLException
        Specified by:
        createBlob in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • createClob

        public java.sql.Clob createClob()
                                 throws java.sql.SQLException
        Specified by:
        createClob in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • createStruct

        public java.sql.Struct createStruct(java.lang.String arg0,
                                   java.lang.Object[] arg1)
                                     throws java.sql.SQLException
        Specified by:
        createStruct in interface java.sql.Connection
        Parameters:
        arg0 -
        arg1 -
        Throws:
        java.sql.SQLException
      • getClientInfo

        public java.util.Properties getClientInfo()
                                           throws java.sql.SQLException
        Specified by:
        getClientInfo in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • getClientInfo

        public java.lang.String getClientInfo(java.lang.String arg0)
                                       throws java.sql.SQLException
        Specified by:
        getClientInfo in interface java.sql.Connection
        Parameters:
        arg0 -
        Throws:
        java.sql.SQLException
      • isValid

        public boolean isValid(int arg0)
                        throws java.sql.SQLException
        Specified by:
        isValid in interface java.sql.Connection
        Parameters:
        arg0 -
        Throws:
        java.sql.SQLException