com.ibm.as400.access
Class AS400JDBCStatement

java.lang.Object
  extended by com.ibm.as400.access.AS400JDBCStatement
All Implemented Interfaces:
Statement, Wrapper
Direct Known Subclasses:
AS400JDBCPreparedStatement

public class AS400JDBCStatement
extends Object
implements Statement

The AS400JDBCStatement class provides a mechanism for executing static SQL statements. Use Connection.createStatement() to create new Statement objects.

Only one result set per statement can be open at any point in time. Therefore, if an application needs to read from multiple result sets, then each must be generated by a different statement.

AS400JDBCStatements are thread-safe.

Note that the connection keeps a reference to each statement that it creates. This means that statements will not get garbage collected until the connection gets garbage collected. It is best to explicitly close statements rather than counting on garbage collection.


Field Summary
Modifier and Type Field and Description
 
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, SUCCESS_NO_INFO
 
Method Summary
Modifier and Type Method and Description
 void addBatch(String sql)
          Adds an SQL statement to the current batch of SQL statements.
 void cancel()
          Cancels the statement.
 void clearBatch()
          Clears the current batch of SQL statements.
 void clearWarnings()
          Clears all warnings that have been reported for the statement.
 void close()
          Releases the statement's resources immediately instead of waiting for them to be automatically released.
 boolean execute(String sql)
          Runs an SQL statement that may return multiple result sets.
 boolean execute(String sql, int autoGeneratedKeys)
          Runs an SQL statement that may return multiple result sets and makes any auto-generated keys available for retrieval using Statement.getGeneratedKeys().
 boolean execute(String sql, int[] columnIndexes)
          Runs an SQL statement that may return multiple result sets and makes any auto-generated keys for the columns indicated in the given array available for retrieval using Statement.getGeneratedKeys().
 boolean execute(String sql, String[] columnNames)
          Runs an SQL statement that may return multiple result sets and makes any auto-generated keys for the columns indicated in the given array available for retrieval using Statement.getGeneratedKeys().
 int[] executeBatch()
          Runs the batch of SQL statements.
 ResultSet executeQuery(String sql)
          Runs an SQL statement that returns a single result set.
 int executeUpdate(String sql)
          Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that does not return a result set.
 int executeUpdate(String sql, int autoGeneratedKeys)
          Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that does not return a result set and makes any auto-generated keys available for retrieval using Statement.getGeneratedKeys().
 int executeUpdate(String sql, int[] columnIndexes)
          Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that does not return a result set and makes any auto-generated keys for the columns indicated in the given array available for retrieval using Statement.getGeneratedKeys().
 int executeUpdate(String sql, String[] columnNames)
          Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that does not return a result set and makes any auto-generated keys for the columns indicated in the given array available for retrieval using Statement.getGeneratedKeys().
protected  void finalize()
          Closes the statement if not explicitly closed by the caller.
 Connection getConnection()
          Returns the connection for this statement.
 int getFetchDirection()
          Returns the fetch direction.
 int getFetchSize()
          Returns the fetch size.
 ResultSet getGeneratedKeys()
          Retrieves any auto-generated keys created as a result of executing this Statement object.
 int getMaxFieldSize()
          Returns the maximum field size limit for the statement.
 int getMaxRows()
          Returns the maximum rows limit for the statement.
 boolean getMoreResults()
          Returns the next result set.
 boolean getMoreResults(int current)
          Returns the next result set.
 int getPositionOfSyntaxError()
          Will return the value of the last syntax error that came back from the IBM i system.
 int getQueryTimeout()
          Returns the query timeout limit for this statement.
 ResultSet getResultSet()
          Returns the current result set.
 int getResultSetConcurrency()
          Returns the result set concurrency to be used for this statement.
 int getResultSetHoldability()
          Returns the result set cursor holdability to be used for this statement.
 int getResultSetType()
          Returns the result set type to be used for this statement.
 int getUpdateCount()
          Returns the current update count.
 SQLWarning getWarnings()
          Returns the first warning reported for the statement.
 void setCursorName(String cursorName)
          Sets the SQL cursor name that will be used by the statement.
 void setEscapeProcessing(boolean escapeProcessing)
          Sets the escape processing mode.
 void setFetchDirection(int fetchDirection)
          Sets the direction in which the rows in a result set will be processed.
 void setFetchSize(int fetchSize)
          Sets the number of rows to be fetched from the database when more rows are needed.
 void setMaxFieldSize(int maxFieldSize)
          Sets the maximum field size limit.
 void setMaxRows(int maxRows)
          Sets the maximum rows limit.
 void setQueryTimeout(int queryTimeout)
          Sets the query timeout limit.
 String toString()
          Returns the statement name.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.sql.Statement
isPoolable, setPoolable
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Method Detail

addBatch

public void addBatch(String sql)
              throws SQLException
Adds an SQL statement to the current batch of SQL statements.

Specified by:
addBatch in interface Statement
Parameters:
sql - The SQL statement to be added to the current batch. This can be any SQL statement that does not return a result set.
Throws:
SQLException - If the statement is not open or the SQL statement contains a syntax error.

cancel

public void cancel()
            throws SQLException
Cancels the statement. This is useful when one thread needs to cancel a statement that is being executed by another thread. This will close the current result set.

Specified by:
cancel in interface Statement
Throws:
SQLException - If the statement is not open or an error occurs.

clearBatch

public void clearBatch()
                throws SQLException
Clears the current batch of SQL statements.

Specified by:
clearBatch in interface Statement
Throws:
SQLException - If the statement is not open.

clearWarnings

public void clearWarnings()
                   throws SQLException
Clears all warnings that have been reported for the statement. After this call, getWarnings() returns null until a new warning is reported for the statement.

Specified by:
clearWarnings in interface Statement
Throws:
SQLException - If an error occurs.

close

public void close()
           throws SQLException
Releases the statement's resources immediately instead of waiting for them to be automatically released. This closes the current result set.

Specified by:
close in interface Statement
Throws:
SQLException - If an error occurs.

execute

public boolean execute(String sql)
                throws SQLException
Runs an SQL statement that may return multiple result sets. This closes the current result set and clears warnings before executing the new SQL statement.

Under some situations, a single SQL statement may return multiple result sets, an update count, or both. This might occur when executing a stored procedure that returns multiple result sets or when dynamically executing an unknown SQL string.

Use getMoreResults(), getResultSet(), and getUpdateCount() to navigate through multiple result sets, an update count, or both.

Specified by:
execute in interface Statement
Parameters:
sql - The SQL statement.
Returns:
true if a result set was returned, false if an update count was returned or nothing was returned.
Throws:
SQLException - If the statement is not open, the SQL statement contains a syntax error, the query timeout limit is exceeded, or an error occurs.

execute

public boolean execute(String sql,
                       int autoGeneratedKeys)
                throws SQLException
Runs an SQL statement that may return multiple result sets and makes any auto-generated keys available for retrieval using Statement.getGeneratedKeys(). This closes the current result set and clears warnings before executing the new SQL statement.

Under some situations, a single SQL statement may return multiple result sets, an update count, or both. This might occur when executing a stored procedure that returns multiple result sets or when dynamically executing an unknown SQL string.

Use getMoreResults(), getResultSet(), and getUpdateCount() to navigate through multiple result sets, an update count, or both.

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

Specified by:
execute in interface Statement
Parameters:
sql - The SQL statement.
autoGeneratedKeys - Indicates whether auto-generated keys should be made available for retrieval. Valid values are Statement.RETURN_GENERATED_KEYS and Statement.NO_GENERATED_KEYS.
Returns:
true if a result set was returned, false if an update count was returned or nothing was returned.
Throws:
SQLException - If the statement is not open, the SQL statement contains a syntax error, the query timeout limit is exceeded, the value for autoGeneratedKeys is not a valid value, if connecting to OS/400 V5R1 or earlier, an error occurs.
Since:
Modification 5

execute

public boolean execute(String sql,
                       int[] columnIndexes)
                throws SQLException
Runs an SQL statement that may return multiple result sets and makes any auto-generated keys for the columns indicated in the given array available for retrieval using Statement.getGeneratedKeys(). This closes the current result set and clears warnings before executing the new SQL statement.

Under some situations, a single SQL statement may return multiple result sets, an update count, or both. This might occur when executing a stored procedure that returns multiple result sets or when dynamically executing an unknown SQL string.

Use getMoreResults(), getResultSet(), and getUpdateCount() to navigate through multiple result sets, an update count, or both.

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

Specified by:
execute in interface Statement
Parameters:
sql - The SQL statement.
columnIndexes - Indicates that auto-generated keys for the indicated columns should be made available for retrieval.
Returns:
true if a result set was returned, false if an update count was returned or nothing was returned.
Throws:
SQLException - - If connecting to IBM i V5R4 or earlier systems, if the statement is not open, the SQL statement contains a syntax error, the query timeout limit is exceeded, the value for columnIndexes is not a valid value, or an error occurs.
Since:
Modification 5

execute

public boolean execute(String sql,
                       String[] columnNames)
                throws SQLException
Runs an SQL statement that may return multiple result sets and makes any auto-generated keys for the columns indicated in the given array available for retrieval using Statement.getGeneratedKeys(). This closes the current result set and clears warnings before executing the new SQL statement.

Under some situations, a single SQL statement may return multiple result sets, an update count, or both. This might occur when executing a stored procedure that returns multiple result sets or when dynamically executing an unknown SQL string.

Use getMoreResults(), getResultSet(), and getUpdateCount() to navigate through multiple result sets, an update count, or both.

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

Specified by:
execute in interface Statement
Parameters:
sql - The SQL statement.
columnNames - Indicates that auto-generated keys for the indicated columns should be made available for retrieval.
Returns:
true if a result set was returned, false if an update count was returned or nothing was returned.
Throws:
SQLException - - If connecting to IBM i V5R4 or earlier systems, if the statement is not open, the SQL statement contains a syntax error, the query timeout limit is exceeded, the value for columnNames is not a valid value, or an error occurs.
Since:
Modification 5

executeBatch

public int[] executeBatch()
                   throws SQLException
Runs the batch of SQL statements. Batch updates can be used to submit a set of SQL statements together as a single unit. The SQL statements are run in the order in which they were added to the batch. The batch is cleared after the SQL statements are run. In addition, this closes the current result set and clears warnings before executing the new SQL statement.

When batch updates are run, autocommit should usually be turned off. This allows the caller to decide whether or not to commit the transaction in the event that an error occurs and some of the SQL statements in a batch fail to run.

Specified by:
executeBatch in interface Statement
Returns:
An array of row counts for the SQL statements that are run. The array contains one element for each statement in the batch of SQL statements. The array is ordered according to the order in which the SQL statements were added to the batch.
Throws:
SQLException - If the statement is not open, an SQL statement contains a syntax error, the query timeout limit is exceeded, an SQL statement returns a result set, or an error occurs.

executeQuery

public ResultSet executeQuery(String sql)
                       throws SQLException
Runs an SQL statement that returns a single result set. This closes the current result set and clears warnings before executing the new SQL statement.

Specified by:
executeQuery in interface Statement
Parameters:
sql - The SQL statement.
Returns:
The result set that contains the data produced by the query.
Throws:
SQLException - If the statement is not open, the SQL statement contains a syntax error, no result set is returned by the database, the query timeout limit is exceeded, or an error occurs.

executeUpdate

public int executeUpdate(String sql)
                  throws SQLException
Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that does not return a result set. This closes the current result set and clears warnings before executing the new SQL statement.

Specified by:
executeUpdate in interface Statement
Parameters:
sql - The SQL statement.
Returns:
Either the row count for INSERT, UPDATE, or DELETE, or 0 for SQL statements that return nothing.
Throws:
SQLException - If the statement is not open, the SQL statement contains a syntax error, the query timeout limit is exceeded, the statement returns a result set, or an error occurs.

executeUpdate

public int executeUpdate(String sql,
                         int autoGeneratedKeys)
                  throws SQLException
Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that does not return a result set and makes any auto-generated keys available for retrieval using Statement.getGeneratedKeys(). This closes the current result set and clears warnings before executing the new SQL statement.

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

Specified by:
executeUpdate in interface Statement
Parameters:
sql - The SQL statement.
Returns:
Either the row count for INSERT, UPDATE, or DELETE, or 0 for SQL statements that return nothing.
Throws:
SQLException - If the statement is not open, the SQL statement contains a syntax error, the query timeout limit is exceeded, the statement returns a result set, the value for autoGeneratedKeys is not a valid value, if connecting to OS/400 V5R1 or earlier, an error occurs.
Since:
Modification 5

executeUpdate

public int executeUpdate(String sql,
                         int[] columnIndexes)
                  throws SQLException
Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that does not return a result set and makes any auto-generated keys for the columns indicated in the given array available for retrieval using Statement.getGeneratedKeys(). This closes the current result set and clears warnings before executing the new SQL statement.

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

Specified by:
executeUpdate in interface Statement
Parameters:
sql - The SQL statement.
columnIndexes - The indexes of columns for which auto-generated keys should be made available for retrieval.
Returns:
Either the row count for INSERT, UPDATE, or DELETE, or 0 for SQL statements that return nothing.
Throws:
SQLException - If connection to IBM i V5R4 or earlier systems, the statement is not open, the SQL statement contains a syntax error, the query timeout limit is exceeded, the statement returns a result set, the value for autoGeneratedKeys is not a valid value or an error occurs.
Since:
Modification 5

executeUpdate

public int executeUpdate(String sql,
                         String[] columnNames)
                  throws SQLException
Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that does not return a result set and makes any auto-generated keys for the columns indicated in the given array available for retrieval using Statement.getGeneratedKeys(). This closes the current result set and clears warnings before executing the new SQL statement.

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

Specified by:
executeUpdate in interface Statement
Parameters:
sql - The SQL statement.
columnNames - The column names for which auto-generated keys should be made available for retrieval.
Returns:
Either the row count for INSERT, UPDATE, or DELETE, or 0 for SQL statements that return nothing.
Throws:
SQLException - If connection to IBM i V5R4 or earlier systems, the statement is not open, the SQL statement contains a syntax error, the query timeout limit is exceeded, the statement returns a result set, the value for autoGeneratedKeys is not a valid value or an error occurs.
Since:
Modification 5

finalize

protected void finalize()
                 throws Throwable
Closes the statement if not explicitly closed by the caller.

Overrides:
finalize in class Object
Throws:
Throwable - If an error occurs.

getConnection

public Connection getConnection()
                         throws SQLException
Returns the connection for this statement.

Specified by:
getConnection in interface Statement
Returns:
The connection for this statement.
Throws:
SQLException - If an error occurs.

getFetchDirection

public int getFetchDirection()
                      throws SQLException
Returns the fetch direction.

Specified by:
getFetchDirection in interface Statement
Returns:
The fetch direction.
Throws:
SQLException - If the statement is not open.

getFetchSize

public int getFetchSize()
                 throws SQLException
Returns the fetch size.

Specified by:
getFetchSize in interface Statement
Returns:
The fetch size.
Throws:
SQLException - If the statement is not open.

getGeneratedKeys

public ResultSet getGeneratedKeys()
                           throws SQLException
Retrieves any auto-generated keys created as a result of executing this Statement object. Currently DB2 for IBM i supports returning only one auto-generated key to the Toolbox JDBC driver -- the key for the last inserted row. Be aware that the generated key returned is not guaranteed to be unique unless a unique constraint is created on the table.

In order for this method to return auto-generated keys, the statement must be executed on a table with an identity column. For more information about identity columns, Go to the IBM i Information Center, and search on the phrase "identity column".

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

This method will return null if the user did not request auto-generated keys during the execute of a Statement or during the prepare of a PreparedStatement. This method will also return null if the application has not executed the statement before calling this method.

This method will return an empty result set if the database did not generate any auto-generated keys when executing the statement.

Specified by:
getGeneratedKeys in interface Statement
Returns:
The ResultSet object containing the auto-generated key(s) generated by the execution of this Statement object, an empty result set if the database did not generate any auto-generated keys, or null if the application did not request auto-generated keys or did not execute the statement before calling this method.
Throws:
SQLException - If the statement is not open, if connecting to OS/400 V5R1 or earlier, an error occurs.
Since:
Modification 5

getMaxFieldSize

public int getMaxFieldSize()
                    throws SQLException
Returns the maximum field size limit for the statement. The maximum field size limit is the maximum amount of data returned for any column value. It applies only to BINARY, VARBINARY, CHAR, and VARCHAR fields. If the limit is exceeded, then the excess data is discarded.

Specified by:
getMaxFieldSize in interface Statement
Returns:
The maximum field size limit (in bytes), or 0 for no limit.
Throws:
SQLException - If the statement is not open.

getMaxRows

public int getMaxRows()
               throws SQLException
Returns the maximum rows limit for the statement. The maximum rows limit is the maximum number of rows that a result set can contain. If the limit is exceeded, then the excess rows are dropped.

Specified by:
getMaxRows in interface Statement
Returns:
The maximum rows limit, or 0 for no limit.
Throws:
SQLException - If the statement is not open.

getMoreResults

public boolean getMoreResults()
                       throws SQLException
Returns the next result set. This closes the current result set.

Specified by:
getMoreResults in interface Statement
Returns:
true if another result set is available, false if there are no more result sets.
Throws:
SQLException - If an error occurs.

getMoreResults

public boolean getMoreResults(int current)
                       throws SQLException
Returns the next result set. This closes the current result set. This method handles any current ResultSet object(s) according to the instructions specified by the actionOnCurrentResultSet parameter, and returns true if the next result is a ResultSet object.

Specified by:
getMoreResults in interface Statement
Parameters:
current - What should happen to current ResultSet objects obtained using the method getResultSet. Valid values are CLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT, and CLOSE_ALL_RESULTS.
Returns:
Always false because this method is not supported.
Throws:
SQLException - if DatabaseMetaData.supportsMultipleOpenResults returns false and either Statement.KEEP_CURRENT_RESULT or Statement.CLOSE_ALL_RESULTS are supplied as the argument.
Since:
Modification 5

getPositionOfSyntaxError

public int getPositionOfSyntaxError()
                             throws SQLException
Will return the value of the last syntax error that came back from the IBM i system.

Returns:
The value of the character of the last syntax error from the system, or 0 if no errors occurred or the value is not known.
Throws:
SQLException - If the statement is not open.

getQueryTimeout

public int getQueryTimeout()
                    throws SQLException
Returns the query timeout limit for this statement. The query timeout limit is the number of seconds that the driver will wait for an SQL statement to execute.

Specified by:
getQueryTimeout in interface Statement
Returns:
The query timeout limit (in seconds), or 0 for no limit.
Throws:
SQLException - If the statement is not open.

getResultSet

public ResultSet getResultSet()
                       throws SQLException
Returns the current result set.

Specified by:
getResultSet in interface Statement
Returns:
The current result set, or null if an update count was returned or there are no more result sets.
Throws:
SQLException - If the statement is not open.

getResultSetConcurrency

public int getResultSetConcurrency()
                            throws SQLException
Returns the result set concurrency to be used for this statement.

Specified by:
getResultSetConcurrency in interface Statement
Returns:
The result set concurrency.
Throws:
SQLException - If the statement is not open.

getResultSetHoldability

public int getResultSetHoldability()
                            throws SQLException
Returns the result set cursor holdability to be used for this statement.

Specified by:
getResultSetHoldability in interface Statement
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, if any, that was specified on statement creation using the methods createStatement(), prepareCall(), or prepareStatement() on the Connection object.
  • 2. The holdability specified using the method setHoldability(int) if this method was called on the Connection object.
  • 3. If neither of above methods were called, the value of the cursor hold driver property.
Full functionality of #1 and #2 requires OS/400 v5r2 or IBM i. If connecting to OS/400 V5R1 or earlier, the value specified on these two methods will be ignored and the default holdability will be the value of #3.
Throws:
SQLException - If the statement is not open.
Since:
Modification 5

getResultSetType

public int getResultSetType()
                     throws SQLException
Returns the result set type to be used for this statement.

Specified by:
getResultSetType in interface Statement
Returns:
The result set type.
Throws:
SQLException - If the statement is not open.

getUpdateCount

public int getUpdateCount()
                   throws SQLException
Returns the current update count.

Specified by:
getUpdateCount in interface Statement
Returns:
The update count, or -1 if a result set was returned or there are no more result sets.
Throws:
SQLException - If the statement is not open.

getWarnings

public SQLWarning getWarnings()
                       throws SQLException
Returns the first warning reported for the statement. Subsequent warnings may be chained to this warning.

Specified by:
getWarnings in interface Statement
Returns:
The first warning, or null if no warnings have been reported.
Throws:
SQLException - If an error occurs.

setCursorName

public void setCursorName(String cursorName)
                   throws SQLException
Sets the SQL cursor name that will be used by the statement. Cursor names must be unique within the connection. The cursor name can only be set when no result set is open.

The cursor name can be used in SQL positioned UPDATE or DELETE statements to identify the current row in the result set generated by this statement. By definition, SQL positioned UPDATEs or DELETEs must be executed by a different statement than the one that generated the result set being used for positioning.

Cursor names are case sensitive. However, when using a cursor name within other SQL positioned UPDATE or DELETE statements, the cursor name will be uppercased. If you use a cursor name with lowercase characters, you need to enclose it in double quotes when referring to it in other SQL statements.

Specified by:
setCursorName in interface Statement
Parameters:
cursorName - The cursor name. If null, a unique default name will be used.
Throws:
SQLException - If the statement is not open, a result set is open, the cursor name is not unique within the connection, or an error occurs.

setEscapeProcessing

public void setEscapeProcessing(boolean escapeProcessing)
                         throws SQLException
Sets the escape processing mode. When processing escape clauses, the JDBC driver substitutes escape clauses in SQL statements with DB2 for IBM i SQL grammar elements. If escape processing is not needed, then setting the escape processing mode to false improves performance.

Specified by:
setEscapeProcessing in interface Statement
Parameters:
escapeProcessing - true to process escape clauses; false otherwise. The default is true.
Throws:
SQLException - If the statement is not open.

setFetchDirection

public void setFetchDirection(int fetchDirection)
                       throws SQLException
Sets the direction in which the rows in a result set will be processed.

This setting is not used.

Specified by:
setFetchDirection in interface Statement
Parameters:
fetchDirection - The fetch direction for processing rows. Valid values are:
  • ResultSet.FETCH_FORWARD
  • ResultSet.FETCH_REVERSE
  • ResultSet.FETCH_UNKNOWN
The default is ResultSet.FETCH_FORWARD.
Throws:
SQLException - If the statement is not open, the result set type is ResultSet.TYPE_FORWARD_ONLY, and the input value is not ResultSet.FETCH_FORWARD, or the input value is not valid.

setFetchSize

public void setFetchSize(int fetchSize)
                  throws SQLException
Sets the number of rows to be fetched from the database when more rows are needed. The number of rows specified only affects result sets created using this statement. If the value specified is zero, then the driver will choose an appropriate fetch size.

This setting only affects statements that meet the criteria specified in the "block criteria" property. The fetch size is only used if the "block size" property is set to "0".

Specified by:
setFetchSize in interface Statement
Parameters:
fetchSize - The number of rows. This must be greater than or equal to 0 and less than or equal to the maximum rows limit. The default is zero.
Throws:
SQLException - If the statement is not open or the input value is not valid.

setMaxFieldSize

public void setMaxFieldSize(int maxFieldSize)
                     throws SQLException
Sets the maximum field size limit. The maximum field size limit is the maximum amount of data returned for any column value. It applies only to BINARY, VARBINARY, CHAR, and VARCHAR fields. If the limit is exceeded, then the excess data is discarded.

Specified by:
setMaxFieldSize in interface Statement
Parameters:
maxFieldSize - The maximum field size limit (in bytes) or 0 for no limit. The default is 0.
Throws:
SQLException - If the statement is not open or the input value is not valid.

setMaxRows

public void setMaxRows(int maxRows)
                throws SQLException
Sets the maximum rows limit. The maximum rows limit is the maximum number of rows that a result set can contain. If the limit is exceeded, the excess rows are dropped.

Specified by:
setMaxRows in interface Statement
Parameters:
maxRows - The maximum rows limit or 0 for no limit. The default is 0.
Throws:
SQLException - If the statement is not open or the input value is not valid.

setQueryTimeout

public void setQueryTimeout(int queryTimeout)
                     throws SQLException
Sets the query timeout limit. The query timeout limit is the number of seconds that the driver will wait for a SQL statement to execute. Beginning with Version 6 Release 1 of IBM i, you must have *JOBCTL special authority.

Specified by:
setQueryTimeout in interface Statement
Parameters:
queryTimeout - The query timeout limit (in seconds) or 0 for no limit. The default is the job's query timeout limit value unless this method is explicitly called.
Throws:
SQLException - If the statement is not open or the input value is not valid.

toString

public String toString()
Returns the statement name.

Overrides:
toString in class Object
Returns:
The statement name.