com.ibm.as400.access

Class AS400JDBCConnectionImpl

  • All Implemented Interfaces:
    java.sql.Connection, java.sql.Wrapper


    public class AS400JDBCConnectionImpl
    extends AS400JDBCConnection

    The AS400JDBCConnection class provides a JDBC connection to a specific DB2 for IBM i database. Use DriverManager.getConnection() to create new AS400JDBCConnection objects.

    There are many optional properties that can be specified when the connection is created. Properties can be specified either as part of the URL or in a java.util.Properties object. See JDBC properties for a complete list of properties supported by the AS400JDBCDriver.

    Note that a connection may contain at most 9999 open statements.

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected static int QUERY_TIMEOUT_CANCEL 
      protected static int QUERY_TIMEOUT_QQRYTIMLMT 
      • 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 cancel(int id)
      Cancels a statement within this connection.
      void checkAccess(JDSQLStatement sqlStatement)
      Checks that the specified SQL statement can be executed.
      void checkCancel()
      Checks to see if we are cancelling a statement.
      boolean checkHoldabilityConstants(int holdability)
      Checks if what the user passed in for holdability is valid.
      void checkOpen()
      Checks that the connection is open.
      void clearWarnings()
      Clears all warnings that have been reported for the connection.
      void close()
      Releases the connection's resources immediately instead of waiting for them to be automatically released.
      void commit()
      Commits all changes made since the previous commit or rollback and releases any database locks currently held by the connection.
      int correctResultSetType(int resultSetType, int resultSetConcurrency)
      Corrects the result set type based on the result set concurrency and posts a warning.
      java.sql.Array createArrayOf(java.lang.String typeName, java.lang.Object[] elements)
      Factory method for creating Array objects.
      java.sql.Blob createBlob()
      Constructs an object that implements the Blob interface.
      java.sql.Clob createClob()
      Constructs an object that implements the Clob interface.
      java.sql.Statement createStatement()
      Creates a Statement object for executing SQL statements without parameters.
      java.sql.Statement createStatement(AS400JDBCConnection con) 
      java.sql.Statement createStatement(AS400JDBCConnection con, int resultSetType, int resultSetConcurrency) 
      java.sql.Statement createStatement(AS400JDBCConnection con, int resultSetType, int resultSetConcurrency, int resultSetHoldability) 
      java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
      Creates a Statement object for executing SQL statements without parameters.
      java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
      Creates a Statement object for executing SQL statements without parameters.
      java.sql.Struct createStruct(java.lang.String typeName, java.lang.Object[] attributes)
      Factory method for creating Struct objects.
      void debug(com.ibm.as400.access.DBBaseRequestDS request)
      Outputs debug information for a request.
      void debug(com.ibm.as400.access.DBReplyRequestedDS reply)
      Outputs debug information for a reply.
      boolean doUpdateDeleteBlocking() 
      void dumpStatementCreationLocation() 
      void finalize()
      Closes the connection if not explicitly closed by the caller.
      java.lang.String getAlternateServer() 
      com.ibm.as400.access.AS400Impl getAS400()
      Returns the AS400 object for this connection.
      boolean getAutoCommit()
      Returns the auto-commit state.
      java.lang.String getCatalog()
      Returns the catalog name.
      boolean getCheckStatementHoldability() 
      java.util.Properties getClientInfo()
      Returns a list containing the name and current value of each client info property supported by the driver.
      java.lang.String getClientInfo(java.lang.String name)
      Returns the value of the client info property specified by name.
      int getConcurrentAccessResolution()
      This method returns the concurrent access resolution setting.
      ConvTable getConverter() 
      ConvTable getConverter(int ccsid)
      Returns the converter for the specified CCSID, unless it is 0 or 65535 (i.e. probably set for a non-text field), in which case it returns the converter for this connection.
      int getDataCompression()
      Returns the style of data compression.
      java.lang.String getDefaultSchema()
      Returns the default SQL schema.
      java.lang.String getDefaultSchema(boolean returnRawValue)
      Returns the default SQL schema.
      int getHoldability()
      Returns the holdability of ResultSets created from this connection.
      java.lang.String getHostName() 
      int getID()
      Returns the ID of the connection.
      int getInternalHoldability()
      Returns the holdability of ResultSets created from this connection.
      java.lang.String getLastServerSQLState() 
      int getMaximumBlockedInputRows() 
      java.sql.DatabaseMetaData getMetaData()
      Returns the DatabaseMetaData object that describes the connection's tables, supported SQL grammar, stored procedures, capabilities and more.
      boolean getMustSpecifyForUpdate() 
      int getNetworkTimeout()
      Retrieves the number of milliseconds the driver will wait for a database request to complete.
      ConvTable getPackageCCSID_Converter() 
      java.lang.String getPort() 
      JDProperties getProperties()
      Returns the connection properties.
      boolean getReadOnly() 
      java.lang.String[] getReconnectURLs()
      Returns a String array containing the URLs that are used when to reconnect to a system when the "enableClientAffinities" property is set.
      java.lang.String getSchema()
      Retrieves this Connection object's current schema name.
      int getServerFunctionalLevel() 
      java.lang.String getServerJobIdentifier()
      Returns the job identifier of the host server job corresponding to this connection.
      AS400 getSystem()
      Returns the system object which is managing the connection to the system.
      int getTransactionIsolation()
      Returns the transaction isolation level.
      com.ibm.as400.access.JDTransactionManager getTransactionManager() 
      java.util.Map getTypeMap()
      Returns the type map.
      int getUnusedId(int resultSetType)
      Returns the next unused id.
      java.lang.String getURL()
      Returns the URL for the connection's database.
      java.lang.String getUserName()
      Returns the user name as currently signed on to the system.
      java.lang.String[] getValidWrappedList() 
      int getVRM() 
      java.sql.SQLWarning getWarnings()
      Returns the first warning reported for the connection.
      void handleAbort() 
      boolean ignoreWarning(java.sql.SQLWarning warning) 
      boolean ignoreWarning(java.lang.String sqlState) 
      boolean isClosed()
      Indicates if the connection is closed.
      boolean isCursorNameUsed(java.lang.String cursorName)
      Indicates if the specified cursor name is already used in the connection.
      boolean isQueryTimeoutMechanismCancel()
      Is SQL cancel used for the query timeout mechanism
      boolean isReadOnly()
      Indicates if the connection is in read-only mode.
      boolean isReadOnlyAccordingToProperties() 
      java.lang.String makeGeneratedKeySelectStatement(java.lang.String sql) 
      java.lang.String makeGeneratedKeySelectStatement(java.lang.String sql, int[] columnIndexes, java.lang.String[] columnNames) 
      void markCursorsClosed(boolean isRollback)
      Marks all of the cursors as closed.
      void markStatementsClosed() 
      java.lang.String nativeSQL(AS400JDBCConnection con, java.lang.String sql) 
      java.lang.String nativeSQL(java.lang.String sql)
      Returns the native form of an SQL statement without executing it.
      void notifyClose(AS400JDBCStatement statement, int id)
      Notifies the connection that a statement in its context has been closed.
      void postWarning(java.sql.SQLWarning sqlWarning)
      Posts a warning for the connection.
      java.sql.CallableStatement prepareCall(AS400JDBCConnection con, java.lang.String sql) 
      java.sql.CallableStatement prepareCall(AS400JDBCConnection con, java.lang.String sql, int resultSetType, int resultSetConcurrency) 
      java.sql.CallableStatement prepareCall(AS400JDBCConnection con, java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) 
      java.sql.CallableStatement prepareCall(java.lang.String sql)
      Precompiles an SQL stored procedure call with optional input and output parameters and stores it in a CallableStatement object.
      java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
      Precompiles an SQL stored procedure call with optional input and output parameters and stores it in a CallableStatement object.
      java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
      Precompiles an SQL stored procedure call with optional input and output parameters and stores it in a CallableStatement object.
      java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con, java.lang.String sql) 
      java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con, java.lang.String sql, int autoGeneratedKeys) 
      java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con, java.lang.String sql, int[] columnIndexes) 
      java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con, java.lang.String sql, int resultSetType, int resultSetConcurrency) 
      java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con, java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) 
      java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con, java.lang.String sql, java.lang.String[] columnNames) 
      java.sql.PreparedStatement prepareStatement(java.lang.String sql)
      Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object.
      java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys)
      Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object.
      java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes)
      Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object.
      java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
      Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object.
      java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
      Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object.
      java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames)
      Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object.
      void processSavepointRequest(java.lang.String savepointStatement) 
      void pseudoClose()
      Partial closing of the connection.
      com.ibm.as400.access.DBReplyRequestedDS receiveMoreData() 
      void releaseSavepoint(java.sql.Savepoint savepoint)
      Removes the given Savepoint object from the current transaction.
      void rollback()
      Drops all changes made since the previous commit or rollback and releases any database locks currently held by the connection.
      void rollback(java.sql.Savepoint savepoint)
      Undoes all changes made after the specified Savepoint was set.
      void send(com.ibm.as400.access.DBBaseRequestDS request)
      Sends a request data stream to the system using the connection's id and does not expect a reply.
      void send(com.ibm.as400.access.DBBaseRequestDS request, int id)
      Sends a request data stream to the system and does not expect a reply.
      void send(com.ibm.as400.access.DBBaseRequestDS request, int id, boolean leavePending)
      Sends a request data stream to the system and does not expect a reply.
      void sendAndHold(com.ibm.as400.access.DBBaseRequestDS request, int id)
      Holds a request until the next explicit request.
      com.ibm.as400.access.DBReplyRequestedDS sendAndMultiReceive(com.ibm.as400.access.DBBaseRequestDS request) 
      com.ibm.as400.access.DBReplyRequestedDS sendAndReceive(com.ibm.as400.access.DBBaseRequestDS request)
      Sends a request data stream to the system using the connection's id and returns the corresponding reply from the system.
      com.ibm.as400.access.DBReplyRequestedDS sendAndReceive(com.ibm.as400.access.DBBaseRequestDS request, int id)
      Sends a request data stream to the system and returns the corresponding reply from the system.
      void setAutoCommit(boolean autoCommit)
      Sets the auto-commit mode.
      void setCatalog(java.lang.String catalog)
      This method is not supported.
      void setCheckStatementHoldability(boolean check)
      Sets a flag for whether the user has changed the holdability for any of the statements that came from this connection.
      void setClientInfo(java.util.Properties properties)
      Sets the value of the connection's client info properties.
      void setClientInfo(java.lang.String name, java.lang.String value)
      Sets the value of the client info property specified by name to the value specified by value.
      void setConcurrentAccessResolution(int concurrentAccessResolution)
      This method sets concurrent access resolution.
      void setDB2eWLMCorrelator(byte[] bytes)
      Sets the eWLM Correlator.
      void setDBHostServerTrace(boolean trace)
      Starts or stops the Database Host Server trace for this connection.
      void setDisableCompression(boolean disableCompression_) 
      void setDRDA(boolean drda)
      Sets whether the connection is being used for DRDA.
      void setHoldability(int holdability)
      Sets the holdability of ResultSets created from this connection.
      void setLastServerSQLState(java.lang.String lastSqlState) 
      void setNetworkTimeout(int timeout)
      Sets the maximum period a Connection or objects created from the Connection will wait for the database to reply to any one request.
      void setProperties(JDDataSourceURL dataSourceUrl, JDProperties properties, AS400 as400) 
      void setProperties(JDDataSourceURL dataSourceUrl, JDProperties properties, com.ibm.as400.access.AS400Impl as400) 
      void setProperties(JDDataSourceURL dataSourceUrl, JDProperties properties, com.ibm.as400.access.AS400Impl as400, boolean newServer, boolean skipSignonServer) 
      void setReadOnly(boolean readOnly)
      Sets the read-only mode.
      java.sql.Savepoint setSavepoint()
      Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.
      java.sql.Savepoint setSavepoint(java.lang.String name)
      Creates a named savepoint in the current transaction and returns the new Savepoint object that represents it.
      java.sql.Savepoint setSavepoint(java.lang.String name, int id) 
      void setSchema(java.lang.String schema)
      Sets the given schema name to access.
      void setServerAttributes()
      Sets the server attributes.
      void setSystem(AS400 as400) 
      void setTransactionIsolation(int level)
      Sets the transaction isolation level.
      void setTypeMap(java.util.Map typeMap)
      Sets the type map to be used for distinct and structured types.
      void setupVariableFieldCompression()
      Setup the variableFieldCompression flags @K3A
      boolean testDataTruncation(AS400JDBCStatement statementWarningObject, AS400JDBCResultSet resultSetWarningObject, int parameterIndex, boolean isParameter, com.ibm.as400.access.SQLData data, JDSQLStatement sqlStatement)
      Tests if a DataTruncation occurred on the write of a piece of data and throws a DataTruncation exception if so.
      java.lang.String toString()
      Returns the connection's catalog name.
      boolean useExtendedFormats()
      Indicates if the connection is using extended formats.
      boolean useVariableFieldCompression() 
      boolean useVariableFieldInsertCompression() 
      • Methods inherited from class java.lang.Object

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

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

        isWrapperFor, unwrap
    • Method Detail

      • cancel

        public void cancel(int id)
                    throws java.sql.SQLException
        Cancels a statement within this connection.
        Parameters:
        id - The ID of the statement.
        Throws:
        java.sql.SQLException - If the statement cannot be executed.
      • checkAccess

        public void checkAccess(JDSQLStatement sqlStatement)
                         throws java.sql.SQLException
        Checks that the specified SQL statement can be executed. This decision is based on the access specified by the caller and the read only mode.
        Parameters:
        sqlStatement - The SQL statement.
        Throws:
        java.sql.SQLException - If the statement cannot be executed.
      • checkCancel

        public void checkCancel()
        Checks to see if we are cancelling a statement. If so, wait until the cancel is done. If not, go ahead.
      • checkHoldabilityConstants

        public boolean checkHoldabilityConstants(int holdability)
        Checks if what the user passed in for holdability is valid.
      • checkOpen

        public void checkOpen()
                       throws java.sql.SQLException
        Checks that the connection is open. Public methods that require an open connection should call this first.
        Throws:
        java.sql.SQLException - If the connection is not open.
      • clearWarnings

        public void clearWarnings()
                           throws java.sql.SQLException
        Clears all warnings that have been reported for the connection. After this call, getWarnings() returns null until a new warning is reported for the connection.
        Specified by:
        clearWarnings in interface java.sql.Connection
        Specified by:
        clearWarnings in class AS400JDBCConnection
        Throws:
        java.sql.SQLException - If an error occurs.
      • close

        public void close()
                   throws java.sql.SQLException
        Releases the connection's resources immediately instead of waiting for them to be automatically released. This rolls back any active transactions, closes all statements that are running in the context of the connection, and disconnects from the IBM i system.
        Specified by:
        close in interface java.sql.Connection
        Specified by:
        close in class AS400JDBCConnection
        Throws:
        java.sql.SQLException - If an error occurs.
      • handleAbort

        public void handleAbort()
      • commit

        public void commit()
                    throws java.sql.SQLException
        Commits all changes made since the previous commit or rollback and releases any database locks currently held by the connection. This has no effect when the connection is in auto-commit mode.

        This method can not be called when the connection is part of a distributed transaction. See AS400JDBCXAResource for more information.

        Specified by:
        commit in interface java.sql.Connection
        Specified by:
        commit in class AS400JDBCConnection
        Throws:
        java.sql.SQLException - If the connection is not open or an error occurs.
      • setCheckStatementHoldability

        public void setCheckStatementHoldability(boolean check)
        Sets a flag for whether the user has changed the holdability for any of the statements that came from this connection. As of JDBC 3.0, the user can specify a statement-level holdability that is different from the statement-level holdability. Rather than always going through all of the statements to see if any of their holidabilities is different, we will mark this flag if the user changes any of the statement holdabilities.
      • correctResultSetType

        public int correctResultSetType(int resultSetType,
                               int resultSetConcurrency)
                                 throws java.sql.SQLException
        Corrects the result set type based on the result set concurrency and posts a warning.
        Parameters:
        resultSetType - The result set type.
        resultSetConcurrency - The result set concurrency.
        Returns:
        The correct result set type.
        Throws:
        java.sql.SQLException
      • createStatement

        public java.sql.Statement createStatement()
                                           throws java.sql.SQLException
        Creates a Statement object for executing SQL statements without parameters. If the same SQL statement is executed many times, it is more efficient to use prepareStatement().

        Result sets created using the statement will be type ResultSet.TYPE_FORWARD_ONLY and concurrency ResultSet.CONCUR_READ_ONLY.

        Specified by:
        createStatement in interface java.sql.Connection
        Specified by:
        createStatement in class AS400JDBCConnection
        Returns:
        The statement object.
        Throws:
        java.sql.SQLException - If the connection is not open, the maximum number of statements for this connection has been reached, or an error occurs.
      • createStatement

        public java.sql.Statement createStatement(AS400JDBCConnection con)
                                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • createStatement

        public java.sql.Statement createStatement(int resultSetType,
                                         int resultSetConcurrency)
                                           throws java.sql.SQLException
        Creates a Statement object for executing SQL statements without parameters. If the same SQL statement is executed many times, it is more efficient to use prepareStatement().
        Specified by:
        createStatement in interface java.sql.Connection
        Specified by:
        createStatement in class AS400JDBCConnection
        Parameters:
        resultSetType - The result set type. Valid values are:
        • ResultSet.TYPE_FORWARD_ONLY
        • ResultSet.TYPE_SCROLL_INSENSITIVE
        • ResultSet.TYPE_SCROLL_SENSITIVE
        resultSetConcurrency - The result set concurrency. Valid values are:
        • ResultSet.CONCUR_READ_ONLY
        • ResultSet.CONCUR_UPDATABLE
        Returns:
        The statement object.
        Throws:
        java.sql.SQLException - If the connection is not open, the maximum number of statements for this connection has been reached, the result type or currency is not supported, or an error occurs.
      • createStatement

        public java.sql.Statement createStatement(AS400JDBCConnection con,
                                         int resultSetType,
                                         int resultSetConcurrency)
                                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • createStatement

        public java.sql.Statement createStatement(int resultSetType,
                                         int resultSetConcurrency,
                                         int resultSetHoldability)
                                           throws java.sql.SQLException
        Creates a Statement object for executing SQL statements without parameters. If the same SQL statement is executed many times, it is more efficient to use prepareStatement().

        Full functionality of this method requires support in OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, the value for resultSetHoldability will be ignored.

        Specified by:
        createStatement in interface java.sql.Connection
        Specified by:
        createStatement in class AS400JDBCConnection
        Parameters:
        resultSetType - The result set type. Valid values are:
        • ResultSet.TYPE_FORWARD_ONLY
        • ResultSet.TYPE_SCROLL_INSENSITIVE
        • ResultSet.TYPE_SCROLL_SENSITIVE
        resultSetConcurrency - The result set concurrency. Valid values are:
        • ResultSet.CONCUR_READ_ONLY
        • ResultSet.CONCUR_UPDATABLE
        resultSetHoldability - The result set holdability. Valid values are:
        • ResultSet.HOLD_CURSORS_OVER_COMMIT
        • ResultSet.CLOSE_CURSORS_AT_COMMIT
        Returns:
        The statement object.
        Throws:
        java.sql.SQLException - If the connection is not open, the maximum number of statements for this connection has been reached, the result type, currency, or holdability is not supported, or an error occurs.
        Since:
        Modification 5
      • createStatement

        public java.sql.Statement createStatement(AS400JDBCConnection con,
                                         int resultSetType,
                                         int resultSetConcurrency,
                                         int resultSetHoldability)
                                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • debug

        public void debug(com.ibm.as400.access.DBBaseRequestDS request)
        Outputs debug information for a request. This should only be used for debugging the JDBC driver and is not intended for production code.
        Parameters:
        request - The request.
      • debug

        public void debug(com.ibm.as400.access.DBReplyRequestedDS reply)
        Outputs debug information for a reply. This should only be used for debugging the JDBC driver and is not intended for production code.
        Parameters:
        reply - The reply.
      • finalize

        public void finalize()
                      throws java.lang.Throwable
        Closes the connection if not explicitly closed by the caller.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable - If an error occurs.
      • getAS400

        public com.ibm.as400.access.AS400Impl getAS400()
                                                throws java.sql.SQLException
        Returns the AS400 object for this connection.
        Returns:
        The AS400 object.
        Throws:
        java.sql.SQLException
      • getAutoCommit

        public boolean getAutoCommit()
                              throws java.sql.SQLException
        Returns the auto-commit state.
        Specified by:
        getAutoCommit in interface java.sql.Connection
        Specified by:
        getAutoCommit in class AS400JDBCConnection
        Returns:
        true if the connection is in auto-commit mode; false otherwise.
        Throws:
        java.sql.SQLException - If the connection is not open.
      • getCatalog

        public java.lang.String getCatalog()
                                    throws java.sql.SQLException
        Returns the catalog name.
        Specified by:
        getCatalog in interface java.sql.Connection
        Specified by:
        getCatalog in class AS400JDBCConnection
        Returns:
        The catalog name.
        Throws:
        java.sql.SQLException - If the connection is not open.
      • getConverter

        public ConvTable getConverter(int ccsid)
                               throws java.sql.SQLException
        Returns the converter for the specified CCSID, unless it is 0 or 65535 (i.e. probably set for a non-text field), in which case it returns the converter for this connection. This is useful for code that handles all types of fields in a generic manner.
        Parameters:
        ccsid - The CCSID.
        Returns:
        The converter.
        Throws:
        java.sql.SQLException - If the CCSID is not valid.
      • getDataCompression

        public int getDataCompression()
        Returns the style of data compression.
        Returns:
        The style of data compression. Possible values are DATA_COMPRESSION_NONE_, DATA_COMPRESSION_OLD_, and DATA_COMPRESSION_RLE_.
      • getDefaultSchema

        public java.lang.String getDefaultSchema()
                                          throws java.sql.SQLException
        Returns the default SQL schema.
        Returns:
        The default SQL schema, or QGPL if none was specified.
        Throws:
        java.sql.SQLException
      • getDefaultSchema

        public java.lang.String getDefaultSchema(boolean returnRawValue)
                                          throws java.sql.SQLException
        Returns the default SQL schema.
        Parameters:
        returnRawValue - Indicates what to return if default SQL schema has not been set. If true, return raw value; if false, then return QGPL rather than null.
        Returns:
        The default SQL schema. If returnRawValue==false and no default SQL schema was specified, then return QGPL rather than null.
        Throws:
        java.sql.SQLException
      • getHoldability

        public int getHoldability()
                           throws java.sql.SQLException
        Returns the holdability of ResultSets created from this connection.
        Specified by:
        getHoldability in interface java.sql.Connection
        Specified by:
        getHoldability in class AS400JDBCConnection
        Returns:
        The cursor holdability. Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT and ResultSet.CLOSE_CURSORS_AT_COMMIT. The holdability is derived in this order of precedence:
        • 1. The holdability specified using the method setHoldability(int) if this method was called.
        • 2. The value of the cursor hold driver property.
        Full functionality of #1 requires support in OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, the value specified on this method will be ignored and the default holdability will be the value of #2.
        Throws:
        java.sql.SQLException - If the connection is not open.
        Since:
        Modification 5
      • getID

        public int getID()
        Returns the ID of the connection.
        Returns:
        The connection ID.
      • getInternalHoldability

        public int getInternalHoldability()
        Returns the holdability of ResultSets created from this connection. Use this method internally to return the value specified if the user has called setHoldability(int), or HOLDABILITY_NOT_SPECIFIED if that method hasn't been called, meaning to use the old behavior and not the new code point for cursor holdability.
        Returns:
        The cursor holdability. Valid values are AS400JDBCResultSet.HOLD_CURSORS_OVER_COMMIT, AS400JDBCResultSet.CLOSE_CURSORS_AT_COMMIT, and AS400JDBCResultSet.HOLDABILITY_NOT_SPECIFIED.
        Since:
        Modification 5
      • getMetaData

        public java.sql.DatabaseMetaData getMetaData()
                                              throws java.sql.SQLException
        Returns the DatabaseMetaData object that describes the connection's tables, supported SQL grammar, stored procedures, capabilities and more.
        Specified by:
        getMetaData in interface java.sql.Connection
        Specified by:
        getMetaData in class AS400JDBCConnection
        Returns:
        The metadata object.
        Throws:
        java.sql.SQLException - If an error occurs.
      • getProperties

        public JDProperties getProperties()
                                   throws java.sql.SQLException
        Returns the connection properties.
        Specified by:
        getProperties in class AS400JDBCConnection
        Returns:
        The connection properties.
        Throws:
        java.sql.SQLException - If a database error occurs.
      • getServerJobIdentifier

        public java.lang.String getServerJobIdentifier()
        Returns the job identifier of the host server job corresponding to this connection. Every JDBC connection is associated with a host server job on the IBM i system. The format is:
        • 10 character job name
        • 10 character user name
        • 6 character job number

        Note: Since this method is not defined in the JDBC Connection interface, you typically need to cast a Connection object to AS400JDBCConnection in order to call this method:

            String serverJobIdentifier = ((AS400JDBCConnection)connection).getServerJobIdentifier();
            
        Specified by:
        getServerJobIdentifier in class AS400JDBCConnection
        Returns:
        The server job identifier, or null if not known.
      • getServerFunctionalLevel

        public int getServerFunctionalLevel()
      • getSystem

        public AS400 getSystem()
        Returns the system object which is managing the connection to the system.

        Note: Since this method is not defined in the JDBC Connection interface, you typically need to cast a Connection object to AS400JDBCConnection in order to call this method:

            AS400 system = ((AS400JDBCConnection)connection).getSystem();
            
        Specified by:
        getSystem in class AS400JDBCConnection
        Returns:
        The system.
      • getTransactionIsolation

        public int getTransactionIsolation()
                                    throws java.sql.SQLException
        Returns the transaction isolation level.
        Specified by:
        getTransactionIsolation in interface java.sql.Connection
        Specified by:
        getTransactionIsolation in class AS400JDBCConnection
        Returns:
        The transaction isolation level. Possible values are:
        • TRANSACTION_NONE
        • TRANSACTION_READ_UNCOMMITTED
        • TRANSACTION_READ_COMMITTED
        • TRANSACTION_REPEATABLE_READ
        Throws:
        java.sql.SQLException - If the connection is not open.
      • getTransactionManager

        public com.ibm.as400.access.JDTransactionManager getTransactionManager()
      • getTypeMap

        public java.util.Map getTypeMap()
                                 throws java.sql.SQLException
        Returns the type map.

        This driver does not support the type map.

        Specified by:
        getTypeMap in interface java.sql.Connection
        Specified by:
        getTypeMap in class AS400JDBCConnection
        Returns:
        The type map.
        Throws:
        java.sql.SQLException - This exception is always thrown.
      • getUnusedId

        public int getUnusedId(int resultSetType)
                        throws java.sql.SQLException
        Returns the next unused id.
        Parameters:
        resultSetType - The result set type. This is relevant only when the connection is being used for DRDA.
        Returns:
        The next unused id.
        Throws:
        java.sql.SQLException
      • getMustSpecifyForUpdate

        public boolean getMustSpecifyForUpdate()
      • getURL

        public java.lang.String getURL()
                                throws java.sql.SQLException
        Returns the URL for the connection's database.
        Returns:
        The URL for the database.
        Throws:
        java.sql.SQLException
      • getUserName

        public java.lang.String getUserName()
                                     throws java.sql.SQLException
        Returns the user name as currently signed on to the system.
        Returns:
        The user name.
        Throws:
        java.sql.SQLException
      • getVRM

        public int getVRM()
                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getWarnings

        public java.sql.SQLWarning getWarnings()
                                        throws java.sql.SQLException
        Returns the first warning reported for the connection. Subsequent warnings may be chained to this warning.
        Specified by:
        getWarnings in interface java.sql.Connection
        Specified by:
        getWarnings in class AS400JDBCConnection
        Returns:
        The first warning or null if no warnings have been reported.
        Throws:
        java.sql.SQLException - If an error occurs.
      • isCursorNameUsed

        public boolean isCursorNameUsed(java.lang.String cursorName)
                                 throws java.sql.SQLException
        Indicates if the specified cursor name is already used in the connection.
        Returns:
        true if the cursor name is already used; false otherwise.
        Throws:
        java.sql.SQLException
      • isClosed

        public boolean isClosed()
                         throws java.sql.SQLException
        Indicates if the connection is closed.
        Specified by:
        isClosed in interface java.sql.Connection
        Specified by:
        isClosed in class AS400JDBCConnection
        Returns:
        true if the connection is closed; false otherwise.
        Throws:
        java.sql.SQLException - If an error occurs.
      • isReadOnly

        public boolean isReadOnly()
                           throws java.sql.SQLException
        Indicates if the connection is in read-only mode.
        Specified by:
        isReadOnly in interface java.sql.Connection
        Specified by:
        isReadOnly in class AS400JDBCConnection
        Returns:
        true if the connection is in read-only mode; false otherwise.
        Throws:
        java.sql.SQLException - If the connection is not open.
      • isReadOnlyAccordingToProperties

        public boolean isReadOnlyAccordingToProperties()
                                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • markCursorsClosed

        public void markCursorsClosed(boolean isRollback)
                               throws java.sql.SQLException
        Marks all of the cursors as closed.
        Parameters:
        isRollback - True if we called this from rollback(), false if we called this from commit().
        Throws:
        java.sql.SQLException
      • markStatementsClosed

        public void markStatementsClosed()
      • makeGeneratedKeySelectStatement

        public java.lang.String makeGeneratedKeySelectStatement(java.lang.String sql,
                                                       int[] columnIndexes,
                                                       java.lang.String[] columnNames)
                                                         throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • makeGeneratedKeySelectStatement

        public java.lang.String makeGeneratedKeySelectStatement(java.lang.String sql)
                                                         throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • nativeSQL

        public java.lang.String nativeSQL(java.lang.String sql)
                                   throws java.sql.SQLException
        Returns the native form of an SQL statement without executing it. The JDBC driver converts all SQL statements from the JDBC SQL grammar into the native DB2 for IBM i SQL grammar prior to executing them.
        Specified by:
        nativeSQL in interface java.sql.Connection
        Specified by:
        nativeSQL in class AS400JDBCConnection
        Parameters:
        sql - The SQL statement in terms of the JDBC SQL grammar.
        Returns:
        The translated SQL statement in the native DB2 for IBM i SQL grammar.
        Throws:
        java.sql.SQLException - If the SQL statement has a syntax error.
      • nativeSQL

        public java.lang.String nativeSQL(AS400JDBCConnection con,
                                 java.lang.String sql)
                                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • notifyClose

        public void notifyClose(AS400JDBCStatement statement,
                       int id)
                         throws java.sql.SQLException
        Notifies the connection that a statement in its context has been closed.
        Parameters:
        statement - The statement.
        id - The statement's id.
        Throws:
        java.sql.SQLException
      • postWarning

        public void postWarning(java.sql.SQLWarning sqlWarning)
                         throws java.sql.SQLException
        Posts a warning for the connection.
        Parameters:
        sqlWarning - The warning.
        Throws:
        java.sql.SQLException
      • prepareCall

        public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                               throws java.sql.SQLException
        Precompiles an SQL stored procedure call with optional input and output parameters and stores it in a CallableStatement object. This object can be used to efficiently call the SQL stored procedure multiple times.

        Result sets created using the statement will be type ResultSet.TYPE_FORWARD_ONLY and concurrency ResultSet.CONCUR_READ_ONLY.

        Specified by:
        prepareCall in interface java.sql.Connection
        Specified by:
        prepareCall in class AS400JDBCConnection
        Parameters:
        sql - The SQL stored procedure call.
        Returns:
        The callable statement object.
        Throws:
        java.sql.SQLException - If the connection is not open, the maximum number of statements for this connection has been reached, or an error occurs.
      • prepareCall

        public java.sql.CallableStatement prepareCall(AS400JDBCConnection con,
                                             java.lang.String sql)
                                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • prepareCall

        public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                             int resultSetType,
                                             int resultSetConcurrency)
                                               throws java.sql.SQLException
        Precompiles an SQL stored procedure call with optional input and output parameters and stores it in a CallableStatement object. This object can be used to efficiently call the SQL stored procedure multiple times.
        Specified by:
        prepareCall in interface java.sql.Connection
        Specified by:
        prepareCall in class AS400JDBCConnection
        Parameters:
        sql - The SQL statement.
        resultSetType - The result set type. Valid values are:
        • ResultSet.TYPE_FORWARD_ONLY
        • ResultSet.TYPE_SCROLL_INSENSITIVE
        • ResultSet.TYPE_SCROLL_SENSITIVE
        resultSetConcurrency - The result set concurrency. Valid values are:
        • ResultSet.CONCUR_READ_ONLY
        • ResultSet.CONCUR_UPDATABLE
        Returns:
        The prepared statement object.
        Throws:
        java.sql.SQLException - If the connection is not open, the maximum number of statements for this connection has been reached, the result type or currency is not valid, or an error occurs.
      • prepareCall

        public java.sql.CallableStatement prepareCall(AS400JDBCConnection con,
                                             java.lang.String sql,
                                             int resultSetType,
                                             int resultSetConcurrency)
                                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • prepareCall

        public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                             int resultSetType,
                                             int resultSetConcurrency,
                                             int resultSetHoldability)
                                               throws java.sql.SQLException
        Precompiles an SQL stored procedure call with optional input and output parameters and stores it in a CallableStatement object. This object can be used to efficiently call the SQL stored procedure multiple times.

        Full functionality of this method requires support in OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, the value for resultSetHoldability will be ignored.

        Specified by:
        prepareCall in interface java.sql.Connection
        Specified by:
        prepareCall in class AS400JDBCConnection
        Parameters:
        sql - The SQL statement.
        resultSetType - The result set type. Valid values are:
        • ResultSet.TYPE_FORWARD_ONLY
        • ResultSet.TYPE_SCROLL_INSENSITIVE
        • ResultSet.TYPE_SCROLL_SENSITIVE
        resultSetConcurrency - The result set concurrency. Valid values are:
        • ResultSet.CONCUR_READ_ONLY
        • ResultSet.CONCUR_UPDATABLE
        resultSetHoldability - The result set holdability. Valid values are:
        • ResultSet.HOLD_CURSORS_OVER_COMMIT
        • ResultSet.CLOSE_CURSORS_AT_COMMIT
        Returns:
        The prepared statement object.
        Throws:
        java.sql.SQLException - If the connection is not open, the maximum number of statements for this connection has been reached, the result type, currency, or holdability is not valid, or an error occurs.
        Since:
        Modification 5
      • prepareCall

        public java.sql.CallableStatement prepareCall(AS400JDBCConnection con,
                                             java.lang.String sql,
                                             int resultSetType,
                                             int resultSetConcurrency,
                                             int resultSetHoldability)
                                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                                    throws java.sql.SQLException
        Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object. This object can be used to efficiently execute this SQL statement multiple times.

        Result sets created using the statement will be type ResultSet.TYPE_FORWARD_ONLY and concurrency ResultSet.CONCUR_READ_ONLY.

        Specified by:
        prepareStatement in interface java.sql.Connection
        Specified by:
        prepareStatement in class AS400JDBCConnection
        Parameters:
        sql - The SQL statement.
        Returns:
        The prepared statement object.
        Throws:
        java.sql.SQLException - If the connection is not open, the maximum number of statements for this connection has been reached, or an error occurs.
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con,
                                                  java.lang.String sql)
                                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                  int autoGeneratedKeys)
                                                    throws java.sql.SQLException
        Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object. This object can be used to efficiently execute this SQL statement multiple times.

        This method requires OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, an exception will be thrown.

        Result sets created using the statement will be type ResultSet.TYPE_FORWARD_ONLY and concurrency ResultSet.CONCUR_READ_ONLY.

        Specified by:
        prepareStatement in interface java.sql.Connection
        Specified by:
        prepareStatement in class AS400JDBCConnection
        Parameters:
        sql - The SQL statement.
        autoGeneratedKeys - Whether to return auto generated keys. Valid values are:
        • Statement.RETURN_GENERATED_KEYS
        • Statement.NO_GENERATED_KEYS
        Returns:
        The prepared statement object.
        Throws:
        java.sql.SQLException - If the connection is not open, the maximum number of statements for this connection has been reached, if connecting to OS/400 V5R1 or earlier, an error occurs.
        Since:
        Modification 5
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con,
                                                  java.lang.String sql,
                                                  int autoGeneratedKeys)
                                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                  int resultSetType,
                                                  int resultSetConcurrency)
                                                    throws java.sql.SQLException
        Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object. This object can be used to efficiently execute this SQL statement multiple times.

        Result sets created using the statement will be holdability ResultSet.CLOSE_CURSORS_AT_COMMIT.

        Specified by:
        prepareStatement in interface java.sql.Connection
        Specified by:
        prepareStatement in class AS400JDBCConnection
        Parameters:
        sql - The SQL statement.
        resultSetType - The result set type. Valid values are:
        • ResultSet.TYPE_FORWARD_ONLY
        • ResultSet.TYPE_SCROLL_INSENSITIVE
        • ResultSet.TYPE_SCROLL_SENSITIVE
        resultSetConcurrency - The result set concurrency. Valid values are:
        • ResultSet.CONCUR_READ_ONLY
        • ResultSet.CONCUR_UPDATABLE
        Returns:
        The prepared statement object.
        Throws:
        java.sql.SQLException - If the connection is not open, the maximum number of statements for this connection has been reached, the result type or currency is not valid, or an error occurs.
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con,
                                                  java.lang.String sql,
                                                  int resultSetType,
                                                  int resultSetConcurrency)
                                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                  int resultSetType,
                                                  int resultSetConcurrency,
                                                  int resultSetHoldability)
                                                    throws java.sql.SQLException
        Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object. This object can be used to efficiently execute this SQL statement multiple times.
        Specified by:
        prepareStatement in interface java.sql.Connection
        Specified by:
        prepareStatement in class AS400JDBCConnection
        Parameters:
        sql - The SQL statement.
        resultSetType - The result set type. Valid values are:
        • ResultSet.TYPE_FORWARD_ONLY
        • ResultSet.TYPE_SCROLL_INSENSITIVE
        • ResultSet.TYPE_SCROLL_SENSITIVE
        resultSetConcurrency - The result set concurrency. Valid values are:
        • ResultSet.CONCUR_READ_ONLY
        • ResultSet.CONCUR_UPDATABLE
        resultSetHoldability - The result set holdability. Valid values are:
        • ResultSet.HOLD_CURSORS_OVER_COMMIT
        • ResultSet.CLOSE_CURSORS_AT_COMMIT
        Returns:
        The prepared statement object.
        Throws:
        java.sql.SQLException - If the connection is not open, the maximum number of statements for this connection has been reached, the result type, currency, or holdability is not valid, or an error occurs.
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con,
                                                  java.lang.String sql,
                                                  int resultSetType,
                                                  int resultSetConcurrency,
                                                  int resultSetHoldability)
                                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                  int[] columnIndexes)
                                                    throws java.sql.SQLException
        Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object. This object can be used to efficiently execute this SQL statement multiple times.

        This method is not supported when connecting to IBM i V5R4 or earlier systems.

        Specified by:
        prepareStatement in interface java.sql.Connection
        Specified by:
        prepareStatement in class AS400JDBCConnection
        Parameters:
        sql - The SQL statement.
        columnIndexes - An array of column indexes indicating the columns that should be returned from the inserted row or rows.
        Returns:
        The prepared statement object.
        Throws:
        java.sql.SQLException - - If connecting to IBM i V5R4 or earlier systems, the connection is not open, the maximum number of statements for this connection has been reached, or an error occurs.
        Since:
        Modification 5
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con,
                                                  java.lang.String sql,
                                                  int[] columnIndexes)
                                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                  java.lang.String[] columnNames)
                                                    throws java.sql.SQLException
        Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object. This object can be used to efficiently execute this SQL statement multiple times.

        This method is not supported when connecting to IBM i V5R4 or earlier systems.

        Specified by:
        prepareStatement in interface java.sql.Connection
        Specified by:
        prepareStatement in class AS400JDBCConnection
        Parameters:
        sql - The SQL statement.
        columnNames - An array of column names indicating the columns that should be returned from the inserted row or rows.
        Returns:
        The prepared statement object.
        Throws:
        java.sql.SQLException - - If connecting to IBM i V5R4 or earlier systems, the connection is not open, the maximum number of statements for this connection has been reached, or an error occurs.
        Since:
        Modification 5
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement(AS400JDBCConnection con,
                                                  java.lang.String sql,
                                                  java.lang.String[] columnNames)
                                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • processSavepointRequest

        public void processSavepointRequest(java.lang.String savepointStatement)
                                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • pseudoClose

        public void pseudoClose()
                         throws java.sql.SQLException
        Partial closing of the connection.
        Throws:
        java.sql.SQLException - If a database error occurs.
      • releaseSavepoint

        public void releaseSavepoint(java.sql.Savepoint savepoint)
                              throws java.sql.SQLException
        Removes the given Savepoint object from the current transaction. Any reference to the savepoint after it has been removed will cause an SQLException to be thrown.
        Specified by:
        releaseSavepoint in interface java.sql.Connection
        Specified by:
        releaseSavepoint in class AS400JDBCConnection
        Parameters:
        savepoint - the savepoint to be removed.
        Throws:
        java.sql.SQLException - if a database access error occurs or the given Savepoint is not a valid savepoint in the current transaction.
        Since:
        Modification 5
      • rollback

        public void rollback()
                      throws java.sql.SQLException
        Drops all changes made since the previous commit or rollback and releases any database locks currently held by the connection. This has no effect when the connection is in auto-commit mode.

        This method can not be called when the connection is part of a distributed transaction. See AS400JDBCXAResource for more information.

        Specified by:
        rollback in interface java.sql.Connection
        Specified by:
        rollback in class AS400JDBCConnection
        Throws:
        java.sql.SQLException - If the connection is not open or an error occurs.
      • rollback

        public void rollback(java.sql.Savepoint savepoint)
                      throws java.sql.SQLException
        Undoes all changes made after the specified Savepoint was set.
        Specified by:
        rollback in interface java.sql.Connection
        Specified by:
        rollback in class AS400JDBCConnection
        Parameters:
        savepoint - the savepoint to be rolled back to.
        Throws:
        java.sql.SQLException - if a database access error occurs, the Savepoint is no longer valid, or this Connection is currently in auto-commit mode.
        Since:
        Modification 5
      • send

        public void send(com.ibm.as400.access.DBBaseRequestDS request)
                  throws java.sql.SQLException
        Sends a request data stream to the system using the connection's id and does not expect a reply.
        Parameters:
        request - The request.
        Throws:
        java.sql.SQLException - If an error occurs.
      • send

        public void send(com.ibm.as400.access.DBBaseRequestDS request,
                int id)
                  throws java.sql.SQLException
        Sends a request data stream to the system and does not expect a reply.
        Parameters:
        request - The request.
        id - The id.
        Throws:
        java.sql.SQLException - If an error occurs.
      • send

        public void send(com.ibm.as400.access.DBBaseRequestDS request,
                int id,
                boolean leavePending)
                  throws java.sql.SQLException
        Sends a request data stream to the system and does not expect a reply.
        Parameters:
        request - The request.
        id - The id.
        leavePending - Indicates if the request should be left pending. This indicates whether or not to base the next request on this one.
        Throws:
        java.sql.SQLException - If an error occurs.
      • sendAndHold

        public void sendAndHold(com.ibm.as400.access.DBBaseRequestDS request,
                       int id)
                         throws java.sql.SQLException
        Holds a request until the next explicit request. It will be concatenated at the beginning of the next request.
        Parameters:
        request - The request.
        id - The id.
        Throws:
        java.sql.SQLException - If an error occurs.
      • sendAndReceive

        public com.ibm.as400.access.DBReplyRequestedDS sendAndReceive(com.ibm.as400.access.DBBaseRequestDS request)
                                                               throws java.sql.SQLException
        Sends a request data stream to the system using the connection's id and returns the corresponding reply from the system.
        Parameters:
        request - The request.
        Returns:
        The reply.
        Throws:
        java.sql.SQLException - If an error occurs.
      • sendAndReceive

        public com.ibm.as400.access.DBReplyRequestedDS sendAndReceive(com.ibm.as400.access.DBBaseRequestDS request,
                                                             int id)
                                                               throws java.sql.SQLException
        Sends a request data stream to the system and returns the corresponding reply from the system.
        Parameters:
        request - The request.
        id - The id.
        Returns:
        The reply.
        Throws:
        java.sql.SQLException - If an error occurs.
      • sendAndMultiReceive

        public com.ibm.as400.access.DBReplyRequestedDS sendAndMultiReceive(com.ibm.as400.access.DBBaseRequestDS request)
                                                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • receiveMoreData

        public com.ibm.as400.access.DBReplyRequestedDS receiveMoreData()
                                                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • setAutoCommit

        public void setAutoCommit(boolean autoCommit)
                           throws java.sql.SQLException
        Sets the auto-commit mode. If the connection is in auto-commit mode, then all of its SQL statements are executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by either a commit or rollback.

        By default, the connection is in auto-commit mode. The commit occurs when the statement execution completes or the next statement execute occurs, whichever comes first. In the case of statements returning a result set, the statement execution completes when the last row of the result set has been retrieved or the result set 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 parameter values have been retrieved.

        The auto-commit mode is always false when the connection is part of a distributed transaction. See AS400JDBCXAResource for more information.

        Specified by:
        setAutoCommit in interface java.sql.Connection
        Specified by:
        setAutoCommit in class AS400JDBCConnection
        Parameters:
        autoCommit - true to turn on auto-commit mode, false to turn it off.
        Throws:
        java.sql.SQLException - If the connection is not open or an error occurs.
      • setCatalog

        public void setCatalog(java.lang.String catalog)
                        throws java.sql.SQLException
        This method is not supported.
        Specified by:
        setCatalog in interface java.sql.Connection
        Specified by:
        setCatalog in class AS400JDBCConnection
        Throws:
        java.sql.SQLException - If the connection is not open.
      • setDB2eWLMCorrelator

        public void setDB2eWLMCorrelator(byte[] bytes)
                                  throws java.sql.SQLException
        Sets the eWLM Correlator. It is assumed a valid correlator value is used. If the value is null, all ARM/eWLM implementation will be turned off. eWLM correlators require IBM i V5R3 or later systems. This request is ignored when running to OS/400 V5R2 or earlier systems.
        Specified by:
        setDB2eWLMCorrelator in class AS400JDBCConnection
        Parameters:
        bytes - The eWLM correlator value
        Throws:
        java.sql.SQLException - If a database error occurs.
      • setDRDA

        public void setDRDA(boolean drda)
                     throws java.sql.SQLException
        Sets whether the connection is being used for DRDA.
        Parameters:
        drda - true if the connection is being used for DRDA, false otherwise.
        Throws:
        java.sql.SQLException
      • setHoldability

        public void setHoldability(int holdability)
                            throws java.sql.SQLException
        Sets the holdability of ResultSets created from this connection.

        Full functionality of this method requires OS/400 V5R2 or IBM i. If connecting to OS/400 V5R1 or earlier, all cursors for the connection will be changed to the value of the variable holdability.

        Specified by:
        setHoldability in interface java.sql.Connection
        Specified by:
        setHoldability in class AS400JDBCConnection
        Parameters:
        holdability - The cursor holdability. Valid values are ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT.
        Throws:
        java.sql.SQLException - If the connection is not open or the value passed in is not valid.
        Since:
        Modification 5
      • setProperties

        public void setProperties(JDDataSourceURL dataSourceUrl,
                         JDProperties properties,
                         AS400 as400)
                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • setProperties

        public void setProperties(JDDataSourceURL dataSourceUrl,
                         JDProperties properties,
                         com.ibm.as400.access.AS400Impl as400)
                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • ignoreWarning

        public boolean ignoreWarning(java.lang.String sqlState)
      • ignoreWarning

        public boolean ignoreWarning(java.sql.SQLWarning warning)
      • setProperties

        public void setProperties(JDDataSourceURL dataSourceUrl,
                         JDProperties properties,
                         com.ibm.as400.access.AS400Impl as400,
                         boolean newServer,
                         boolean skipSignonServer)
                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • setReadOnly

        public void setReadOnly(boolean readOnly)
                         throws java.sql.SQLException
        Sets the read-only mode. This will provide read-only access to the database. Read-only mode can be useful by enabling certain database optimizations. If the caller specified "read only" or "read call" for the "access" property, then the read-only mode cannot be set to false. The read-only mode cannot be changed while in the middle of a transaction.

        This method can not be called when the connection is part of a distributed transaction. See AS400JDBCXAResource for more information.

        Specified by:
        setReadOnly in interface java.sql.Connection
        Specified by:
        setReadOnly in class AS400JDBCConnection
        Throws:
        java.sql.SQLException - If the connection is not open, a transaction is active, or the "access" property is set to "read only".
      • setSavepoint

        public java.sql.Savepoint setSavepoint()
                                        throws java.sql.SQLException
        Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.
        • Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back.
        • Savepoints are valid only if autocommit is off. An exception is thrown if autocommit is enabled.
        • Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection.
        • Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier.
        • If the connection option is set to keep cursors open after a traditional rollback, cursors will remain open after a rollback to a savepoint.
        Specified by:
        setSavepoint in interface java.sql.Connection
        Specified by:
        setSavepoint in class AS400JDBCConnection
        Returns:
        The new Savepoint object.
        Throws:
        java.sql.SQLException - if a database access error occurs or this Connection object is currently in auto-commit mode.
        Since:
        Modification 5
      • setSavepoint

        public java.sql.Savepoint setSavepoint(java.lang.String name)
                                        throws java.sql.SQLException
        Creates a named savepoint in the current transaction and returns the new Savepoint object that represents it.
        • Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back.
        • Savepoints are valid only if autocommit is off. An exception is thrown if autocommit is enabled.
        • Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection.
        • Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier.
        • If the connection option is set to keep cursors open after a traditional rollback, cursors will remain open after a rollback to a savepoint.
        Specified by:
        setSavepoint in interface java.sql.Connection
        Specified by:
        setSavepoint in class AS400JDBCConnection
        Parameters:
        name - A String containing the name of the savepoint
        Returns:
        The new Savepoint object.
        Throws:
        java.sql.SQLException - if a database access error occurs or this Connection object is currently in auto-commit mode.
        Since:
        Modification 5
      • setSavepoint

        public java.sql.Savepoint setSavepoint(java.lang.String name,
                                      int id)
                                        throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • setServerAttributes

        public void setServerAttributes()
                                 throws java.sql.SQLException
        Sets the server attributes.
        Throws:
        java.sql.SQLException - If an error occurs.
      • setSystem

        public void setSystem(AS400 as400)
                       throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • setTransactionIsolation

        public void setTransactionIsolation(int level)
                                     throws java.sql.SQLException
        Sets the transaction isolation level. The transaction isolation level cannot be changed while in the middle of a transaction.

        JDBC and DB2 for IBM i use different terminology for transaction isolation levels. The following table provides a terminology mapping:

        IBM i isolation levelJDBC transaction isolation level
        *CHG TRANSACTION_READ_UNCOMMITTED
        *CS TRANSACTION_READ_COMMITTED
        *ALL TRANSACTION_READ_REPEATABLE_READ
        *RR TRANSACTION_SERIALIZABLE
        Specified by:
        setTransactionIsolation in interface java.sql.Connection
        Specified by:
        setTransactionIsolation in class AS400JDBCConnection
        Parameters:
        level - The transaction isolation level. Possible values are:
        • TRANSACTION_READ_UNCOMMITTED
        • TRANSACTION_READ_COMMITTED
        • TRANSACTION_REPEATABLE_READ
        • TRANSACTION_SERIALIZABLE
        Throws:
        java.sql.SQLException - If the connection is not open, the input level is not valid or unsupported, or a transaction is active.
      • setTypeMap

        public void setTypeMap(java.util.Map typeMap)
                        throws java.sql.SQLException
        Sets the type map to be used for distinct and structured types.

        Note: Distinct types are supported by DB2 for IBM i, but are not externalized by the IBM Toolbox for Java JDBC driver. In other words, distinct types behave as if they are the underlying type. Structured types are not supported by DB2 for IBM i. Consequently, this driver does not support the type map.

        Specified by:
        setTypeMap in interface java.sql.Connection
        Specified by:
        setTypeMap in class AS400JDBCConnection
        Parameters:
        typeMap - The type map.
        Throws:
        java.sql.SQLException - This exception is always thrown.
      • toString

        public java.lang.String toString()
        Returns the connection's catalog name. This is the name of the IBM i system.
        Specified by:
        toString in class AS400JDBCConnection
        Returns:
        The catalog name.
      • useExtendedFormats

        public boolean useExtendedFormats()
                                   throws java.sql.SQLException
        Indicates if the connection is using extended formats.
        Returns:
        true if the connection is using extended formats, false otherwise.
        Throws:
        java.sql.SQLException
      • getValidWrappedList

        public java.lang.String[] getValidWrappedList()
      • setClientInfo

        public void setClientInfo(java.lang.String name,
                         java.lang.String value)
                           throws java.sql.SQLException
        Sets the value of the client info property specified by name to the value specified by value.

        Applications may use the DatabaseMetaData.getClientInfoProperties method to determine the client info properties supported by the driver and the maximum length that may be specified for each property.

        The driver stores the value specified in a suitable location in the database. For example in a special register, session parameter, or system table column. For efficiency the driver may defer setting the value in the database until the next time a statement is executed or prepared. Other than storing the client information in the appropriate place in the database, these methods shall not alter the behavior of the connection in anyway. The values supplied to these methods are used for accounting, diagnostics and debugging purposes only.

        The driver shall generate a warning if the client info name specified is not recognized by the driver.

        If the value specified to this method is greater than the maximum length for the property the driver may either truncate the value and generate a warning or generate a SQLException. If the driver generates a SQLException, the value specified was not set on the connection.

        The following client info properties are supported in Toobox for Java.

        • ApplicationName - The name of the application currently utilizing the connection
        • ClientUser - The name of the user that the application using the connection is performing work for. This may not be the same as the user name that was used in establishing the connection.
        • ClientHostname - The hostname of the computer the application using the connection is running on.
        • ClientAccounting - Client accounting information.
        • ClientProgramID - The client program identification.

        Specified by:
        setClientInfo in interface java.sql.Connection
        Specified by:
        setClientInfo in class AS400JDBCConnection
        Parameters:
        name - The name of the client info property to set
        value - The value to set the client info property to. If the value is null, the current value of the specified property is cleared.

        //JDBC40DOC * @throws SQLClientInfoException if the database returns an error while //JDBC40DOC * setting the client info value on the database server.

        Throws:
        java.sql.SQLException
      • setClientInfo

        public void setClientInfo(java.util.Properties properties)
                           throws java.sql.SQLException
        Sets the value of the connection's client info properties. The Properties object contains the names and values of the client info properties to be set. The set of client info properties contained in the properties list replaces the current set of client info properties on the connection. If a property that is currently set on the connection is not present in the properties list, that property is cleared. Specifying an empty properties list will clear all of the properties on the connection. See setClientInfo (String, String) for more information.

        If an error occurs in setting any of the client info properties, a ClientInfoException is thrown. The ClientInfoException contains information indicating which client info properties were not set. The state of the client information is unknown because some databases do not allow multiple client info properties to be set atomically. For those databases, one or more properties may have been set before the error occurred.

        The following client info properties are supported in Toobox for Java.

        • ApplicationName - The name of the application currently utilizing the connection
        • ClientUser - The name of the user that the application using the connection is performing work for. This may not be the same as the user name that was used in establishing the connection.
        • ClientHostname - The hostname of the computer the application using the connection is running on.
        • ClientAccounting - Client accounting information.
        • ClientProgramID - The client program identification.

        Specified by:
        setClientInfo in interface java.sql.Connection
        Specified by:
        setClientInfo in class AS400JDBCConnection
        Parameters:
        properties - the list of client info properties to set

        //JDBC40DOC * @throws SQLClientInfoException If there is a problem with the Client Info. //JDBC40DOC * if the database returns an error while setting the //JDBC40DOC * clientInfo values on the database

        Throws:
        java.sql.SQLException
      • getClientInfo

        public java.lang.String getClientInfo(java.lang.String name)
                                       throws java.sql.SQLException
        Returns the value of the client info property specified by name. This method may return null if the specified client info property has not been set and does not have a default value. This method will also return null if the specified client info property name is not supported by the driver.

        Applications may use the DatabaseMetaData.getClientInfoProperties method to determine the client info properties supported by the driver.

        The following client info properties are supported in Toobox for Java.

        • ApplicationName - The name of the application currently utilizing the connection
        • ClientUser - The name of the user that the application using the connection is performing work for. This may not be the same as the user name that was used in establishing the connection.
        • ClientHostname - The hostname of the computer the application using the connection is running on.
        • ClientAccounting - Client accounting information.
        • ClientProgramID - The client program identification.

        Specified by:
        getClientInfo in interface java.sql.Connection
        Specified by:
        getClientInfo in class AS400JDBCConnection
        Parameters:
        name - The name of the client info property to retrieve

        Returns:
        The value of the client info property specified

        Throws:
        java.sql.SQLException - if the database returns an error when fetching the client info value from the database.

        see java.sql.DatabaseMetaData#getClientInfoProperties

      • getClientInfo

        public java.util.Properties getClientInfo()
                                           throws java.sql.SQLException
        Returns a list containing the name and current value of each client info property supported by the driver. The value of a client info property may be null if the property has not been set and does not have a default value.

        The following client info properties are supported in Toobox for Java.

        • ApplicationName - The name of the application currently utilizing the connection
        • ClientUser - The name of the user that the application using the connection is performing work for. This may not be the same as the user name that was used in establishing the connection.
        • ClientHostname - The hostname of the computer the application using the connection is running on.
        • ClientAccounting - Client accounting information.
        • ClientProgramID - The client program identification.

        Specified by:
        getClientInfo in interface java.sql.Connection
        Specified by:
        getClientInfo in class AS400JDBCConnection
        Returns:
        A Properties object that contains the name and current value of each of the client info properties supported by the driver.

        Throws:
        java.sql.SQLException - if the database returns an error when fetching the client info values from the database
      • createClob

        public java.sql.Clob createClob()
                                 throws java.sql.SQLException
        Constructs an object that implements the Clob interface. The object returned initially contains no data. The setAsciiStream, setCharacterStream and setString methods of the Clob interface may be used to add data to the Clob.
        Specified by:
        createClob in interface java.sql.Connection
        Specified by:
        createClob in class AS400JDBCConnection
        Returns:
        An object that implements the Clob interface
        Throws:
        java.sql.SQLException - if an object that implements the Clob interface can not be constructed.
      • createBlob

        public java.sql.Blob createBlob()
                                 throws java.sql.SQLException
        Constructs an object that implements the Blob interface. The object returned initially contains no data. The setBinaryStream and setBytes methods of the Blob interface may be used to add data to the Blob.
        Specified by:
        createBlob in interface java.sql.Connection
        Specified by:
        createBlob in class AS400JDBCConnection
        Returns:
        An object that implements the Blob interface
        Throws:
        java.sql.SQLException - if an object that implements the Blob interface can not be constructed
      • createArrayOf

        public java.sql.Array createArrayOf(java.lang.String typeName,
                                   java.lang.Object[] elements)
                                     throws java.sql.SQLException
        Factory method for creating Array objects.
        Specified by:
        createArrayOf in interface java.sql.Connection
        Specified by:
        createArrayOf in class AS400JDBCConnection
        Parameters:
        typeName - the SQL name of the type the elements of the array map to. The typeName is a database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This is the value returned by Array.getBaseTypeName For Toolbox, the typeName will correspond to a typename in java.sql.Types.
        elements - the elements that populate the returned object
        Returns:
        an Array object whose elements map to the specified SQL type
        Throws:
        java.sql.SQLException - if a database error occurs, the typeName is null or this method is called on a closed connection
      • createStruct

        public java.sql.Struct createStruct(java.lang.String typeName,
                                   java.lang.Object[] attributes)
                                     throws java.sql.SQLException
        Factory method for creating Struct objects.
        Specified by:
        createStruct in interface java.sql.Connection
        Specified by:
        createStruct in class AS400JDBCConnection
        Parameters:
        typeName - the SQL type name of the SQL structured type that this Struct object maps to. The typeName is the name of a user-defined type that has been defined for this database. It is the value returned by Struct.getSQLTypeName.
        attributes - the attributes that populate the returned object
        Returns:
        a Struct object that maps to the given SQL type and is populated with the given attributes
        Throws:
        java.sql.SQLException - if a database error occurs, the typeName is null or this method is called on a closed connection
      • setDBHostServerTrace

        public void setDBHostServerTrace(boolean trace)
        Starts or stops the Database Host Server trace for this connection. Note: This method is only supported when running to IBM i V5R3 or later and is ignored if you specified to turn on database host server tracing using the 'server trace' connection property.
        Specified by:
        setDBHostServerTrace in class AS400JDBCConnection
        Parameters:
        trace - true to start database host server tracing, false to end it.
      • getSchema

        public java.lang.String getSchema()
                                   throws java.sql.SQLException
        Retrieves this Connection object's current schema name.
        Specified by:
        getSchema in class AS400JDBCConnection
        Returns:
        the current schema name or null if there is none
        Throws:
        java.sql.SQLException - if a database access error occurs or this method is called on a closed connection
      • setNetworkTimeout

        public void setNetworkTimeout(int timeout)
                               throws java.sql.SQLException
        Sets the maximum period a Connection or objects created from the Connection will wait for the database to reply to any one request. If any request remains unanswered, the waiting method will return with a SQLException, and the Connection or objects created from the Connection will be marked as closed. Any subsequent use of the objects, with the exception of the close, isClosed or Connection.isValid methods, will result in a SQLException.

        In the JTOpen JDBC driver, this is implemented by setting the SoTimeout of the underlying socket.

        Currently, setting the network timeout is only supported when the "thread used" property is false.

        When the driver determines that the setNetworkTimeout timeout value has expired, the JDBC driver marks the connection closed and releases any resources held by the connection.

        This method checks to see that there is an SQLPermission object before allowing the method to proceed. If a SecurityManager exists and its checkPermission method denies calling setNetworkTimeout, this method throws a java.lang.SecurityException.

        Specified by:
        setNetworkTimeout in class AS400JDBCConnection
        Parameters:
        timeout - - The time in milliseconds to wait for the database operation to complete. If the JDBC driver does not support milliseconds, the JDBC driver will round the value up to the nearest second. If the timeout period expires before the operation completes, a SQLException will be thrown. A value of 0 indicates that there is no timeout for database operations.
        Throws:
        java.sql.SQLException - - if a database access error occurs, this method is called on a closed connection,or the value specified for seconds is less than 0.
        java.lang.SecurityException - - if a security manager exists and its checkPermission method denies calling setNetworkTimeout.
        See Also:
        SecurityManager.checkPermission(java.security.Permission), Statement.setQueryTimeout(int), //JDBC40DOC * @see #abort(java.util.concurrent.Executor) //JDBC40DOC * @see Executor
      • getNetworkTimeout

        public int getNetworkTimeout()
                              throws java.sql.SQLException
        Retrieves the number of milliseconds the driver will wait for a database request to complete. If the limit is exceeded, a SQLException is thrown.
        Specified by:
        getNetworkTimeout in class AS400JDBCConnection
        Returns:
        The current timeout limit in milliseconds; zero means there is no limit
        Throws:
        java.sql.SQLException - - if a database access error occurs or this method is called on a closed Connection
        Since:
        JTOpen 7.X //JDBC40DOC * @see #setNetworkTimeout(java.util.concurrent.Executor, int)
      • setSchema

        public void setSchema(java.lang.String schema)
                       throws java.sql.SQLException
        Sets the given schema name to access.

        Calling setSchema has no effect on previously created or prepared Statement objects. For the toolbox driver, the DBMS prepare operation takes place immediately when the Connection method prepareStatement or prepareCall is invoked. For maximum portability, setSchema should be called before a Statement is created or prepared.

        Specified by:
        setSchema in class AS400JDBCConnection
        Parameters:
        schema - The name of the schema to use for the connection
        Throws:
        java.sql.SQLException - If a database access error occurs or this method is called on a closed connection
      • isQueryTimeoutMechanismCancel

        public boolean isQueryTimeoutMechanismCancel()
        Is SQL cancel used for the query timeout mechanism
        Returns:
        true if cancel will be used as the query timeout mechanism
      • setupVariableFieldCompression

        public void setupVariableFieldCompression()
        Setup the variableFieldCompression flags @K3A
      • useVariableFieldCompression

        public boolean useVariableFieldCompression()
      • useVariableFieldInsertCompression

        public boolean useVariableFieldInsertCompression()
      • testDataTruncation

        public boolean testDataTruncation(AS400JDBCStatement statementWarningObject,
                                 AS400JDBCResultSet resultSetWarningObject,
                                 int parameterIndex,
                                 boolean isParameter,
                                 com.ibm.as400.access.SQLData data,
                                 JDSQLStatement sqlStatement)
                                   throws java.sql.SQLException
        Tests if a DataTruncation occurred on the write of a piece of data and throws a DataTruncation exception if so. The data truncation flag is also taken into consideration for string data. The rules are: 1) If updating or querying database with numeric data and data truncated, throw exception 2) If string data and suppress truncation, return 3) If updating database with string data and check truncation and data truncated, throw exception 4) If string data is part of a query and check truncation and data truncated, post warning
        Parameters:
        parameterIndex - The index (1-based).
        data - The data that was written or null for SQL NULL.
        Returns:
        true if the caller should validate that the raw bytes are correct
        Throws:
        java.sql.SQLException
      • getConverter

        public ConvTable getConverter()
      • setLastServerSQLState

        public void setLastServerSQLState(java.lang.String lastSqlState)
      • getLastServerSQLState

        public java.lang.String getLastServerSQLState()
      • getPackageCCSID_Converter

        public ConvTable getPackageCCSID_Converter()
      • getReadOnly

        public boolean getReadOnly()
      • getCheckStatementHoldability

        public boolean getCheckStatementHoldability()
      • getReconnectURLs

        public java.lang.String[] getReconnectURLs()
        Description copied from class: AS400JDBCConnection
        Returns a String array containing the URLs that are used when to reconnect to a system when the "enableClientAffinities" property is set. If the property is not set, then an empty array will be returned.
        Specified by:
        getReconnectURLs in class AS400JDBCConnection
        Returns:
        A String array containing the URLS used by "enableClientAffinities".
      • getAlternateServer

        public java.lang.String getAlternateServer()
      • getHostName

        public java.lang.String getHostName()
      • getPort

        public java.lang.String getPort()