Class AS400JDBCPreparedStatementRedirect
- java.lang.Object
-
- com.ibm.as400.access.AS400JDBCStatement
-
- com.ibm.as400.access.AS400JDBCPreparedStatement
-
- com.ibm.as400.access.AS400JDBCPreparedStatementRedirect
-
- All Implemented Interfaces:
- java.sql.PreparedStatement, java.sql.Statement, java.sql.Wrapper
- Direct Known Subclasses:
- AS400JDBCCallableStatementRedirect
public class AS400JDBCPreparedStatementRedirect extends AS400JDBCPreparedStatement
-
-
Field Summary
-
Fields inherited from class com.ibm.as400.access.AS400JDBCStatement
extendedColumnDescriptors_
-
-
Method Summary
Methods Modifier and Type Method and Description void
addBatch()
Adds the set of parameters to the current batch.void
addBatch(java.lang.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
clearParameters()
Releases the resources used by the current input parameter values.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.void
closeOnCompletion()
Specifies that this Statement will be closed when all its dependent result sets are closed.protected void
endCancelThread()
endTheCancelThreadboolean
execute()
Runs an SQL statement that may return multiple result sets.boolean
execute(java.lang.String sql)
Runs an SQL statement that may return multiple result sets.boolean
execute(java.lang.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(java.lang.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(java.lang.String sql, java.lang.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.long[]
executeLargeBatch()
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.long
executeLargeUpdate()
Executes the SQL statement in this PreparedStatement object, which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.long
executeLargeUpdate(java.lang.String sql)
Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement.long
executeLargeUpdate(java.lang.String sql, int autoGeneratedKeys)
Executes the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.long
executeLargeUpdate(java.lang.String sql, int[] columnIndexes)
Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.long
executeLargeUpdate(java.lang.String sql, java.lang.String[] columnNames)
Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.java.sql.ResultSet
executeQuery()
Runs the SQL statement that returns a single result set.java.sql.ResultSet
executeQuery(java.lang.String sql)
Runs an SQL statement that returns a single result set.int
executeUpdate()
Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that does not return a result set.int
executeUpdate(java.lang.String sql)
Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that does not return a result set.int
executeUpdate(java.lang.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(java.lang.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(java.lang.String sql, java.lang.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().java.sql.Connection
getConnection()
Returns the connection for this statement.java.lang.String
getDB2ParameterName(int parm)
Return the name of the parameter for a stored procedure call.int
getFetchDirection()
Returns the fetch direction.int
getFetchSize()
Returns the fetch size.java.sql.ResultSet
getGeneratedKeys()
Retrieves any auto-generated keys created as a result of executing this Statement object.long
getLargeMaxRows()
Retrieves the maximum number of rows that a ResultSet object produced by this Statement object can contain.long
getLargeUpdateCount()
Retrieves the current result as an update count; if the result is a ResultSet object or there are no more results, -1 is returned.int
getMaxFieldSize()
Returns the maximum field size limit for the statement.int
getMaxRows()
Returns the maximum rows limit for the statement.java.sql.ResultSetMetaData
getMetaData()
Returns the ResultSetMetaData object that describes the result set's columns.boolean
getMoreResults()
Returns the next result set.boolean
getMoreResults(int current)
Returns the next result set.java.sql.ParameterMetaData
getParameterMetaData()
Returns the number, types, and properties of a PreparedStatement object's parameters.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.java.sql.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.protected java.lang.String[]
getValidWrappedList()
java.sql.SQLWarning
getWarnings()
Returns the first warning reported for the statement.boolean
isClosed()
Indicates if the statement is closed.boolean
isCloseOnCompletion()
Returns a value indicating whether this Statement will be closed when all its dependent result sets are closed.boolean
isPoolable()
Returns the value of the statements poolable hint, indicating whether pooling of the statement is requested.void
setArray(int parameterIndex, java.sql.Array x)
Sets an input parameter to an Array value.void
setAsciiStream(int parameterIndex, java.io.InputStream stream)
Sets the designated parameter to the given input stream.void
setAsciiStream(int parameterIndex, java.io.InputStream x, int length)
Sets an input parameter to an ASCII stream value.void
setAsciiStream(int parameterIndex, java.io.InputStream stream, long length)
Sets the designated parameter to the given input stream, which will have the specified number of bytes.void
setBigDecimal(int parameterIndex, java.math.BigDecimal x)
Sets an input parameter to a BigDecimal value.void
setBinaryStream(int parameterIndex, java.io.InputStream stream)
Sets the designated parameter to the given input stream.void
setBinaryStream(int parameterIndex, java.io.InputStream stream, int length)
Sets an input parameter to a binary stream value.void
setBinaryStream(int parameterIndex, java.io.InputStream stream, long length)
Sets the designated parameter to the given input stream, which will have the specified number of bytes.void
setBlob(int parameterIndex, java.sql.Blob x)
Sets an input parameter to a Blob value.void
setBlob(int parameterIndex, java.io.InputStream stream)
Sets the designated parameter to aInputStream
object.void
setBlob(int parameterIndex, java.io.InputStream stream, long length)
Sets the designated parameter to anInputStream
object.void
setBoolean(int parameterIndex, boolean x)
Sets an input parameter to a Java boolean value.void
setByte(int parameterIndex, byte x)
Sets an input parameter to a Java byte value.void
setBytes(int parameterIndex, byte[] x)
Sets an input parameter to a Java byte array value.void
setCharacterStream(int parameterIndex, java.io.Reader reader)
Sets the designated parameter to the givenReader
object.void
setCharacterStream(int parameterIndex, java.io.Reader reader, int length)
Sets an input parameter to a character stream value.void
setCharacterStream(int parameterIndex, java.io.Reader reader, long length)
Sets the designated parameter to the givenReader
object, which is the given number of characters long.void
setClob(int parameterIndex, java.sql.Clob x)
Sets an input parameter to a Clob value.void
setClob(int parameterIndex, java.io.Reader reader)
Sets the designated parameter to aReader
object.void
setClob(int parameterIndex, java.io.Reader reader, long length)
Sets the designated parameter to aReader
object.void
setCursorName(java.lang.String name)
Sets the SQL cursor name that will be used by the statement.void
setDate(int parameterIndex, java.sql.Date x)
Sets an input parameter to a java.sql.Date value using the default calendar.void
setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal)
Sets an input parameter to a java.sql.Date value using a calendar other than the default.void
setDB2Default(int parameterIndex)
Sets an input parameter to the default valuevoid
setDB2Unassigned(int parameterIndex)
Sets an input parameter to unassignedvoid
setDBDefault(int parameterIndex)
Sets an input parameter to the default value.void
setDBUnassigned(int parameterIndex)
Sets an input parameter to unassigned.void
setDouble(int parameterIndex, double x)
Sets an input parameter to a Java double value.void
setEscapeProcessing(boolean enable)
Sets the escape processing mode.void
setFetchDirection(int direction)
Sets the direction in which the rows in a result set will be processed.void
setFetchSize(int rows)
Sets the number of rows to be fetched from the database when more rows are needed.void
setFloat(int parameterIndex, float x)
Sets an input parameter to a Java float value.void
setInt(int parameterIndex, int x)
Sets an input parameter to a Java int value.void
setLargeMaxRows(long max)
Sets the limit for the maximum number of rows that any ResultSet object generated by this Statement object can contain to the given number.void
setLong(int parameterIndex, long x)
Sets an input parameter to a Java long value.void
setMaxFieldSize(int max)
Sets the maximum field size limit.void
setMaxRows(int max)
Sets the maximum rows limit.void
setNCharacterStream(int parameterIndex, java.io.Reader reader)
Sets the designated parameter to aReader
object.void
setNCharacterStream(int parameterIndex, java.io.Reader reader, long length)
Sets the designated parameter to aReader
object.void
setNClob(int parameterIndex, java.io.Reader reader)
Sets the designated parameter to aReader
object.void
setNClob(int parameterIndex, java.io.Reader reader, long length)
Sets the designated parameter to aReader
object.void
setNString(int parameterIndex, java.lang.String x)
Sets the designated paramter to the givenString
object.void
setNull(int parameterIndex, int sqlType)
Sets an input parameter to SQL NULL.void
setNull(int parameterIndex, int sqlType, java.lang.String typeName)
Sets an input parameter to SQL NULL.void
setObject(int parameterIndex, java.lang.Object x)
Sets an input parameter to an Object value.void
setObject(int parameterIndex, java.lang.Object x, int targetSqlType)
Sets an input parameter to an Object value.void
setObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale)
Sets an input parameter to an Object value.void
setObject(int parameterIndex, java.lang.Object x, java.lang.Object targetSqlType)
Sets the value of the designated parameter with the given object.void
setObject(int parameterIndex, java.lang.Object x, java.lang.Object targetSqlType, int scaleOrLength)
Sets the value of the designated parameter with the given object.void
setPoolable(boolean poolable)
Requests that aStatement
be pooled or not pooled.void
setQueryTimeout(int seconds)
Sets the query timeout limit.void
setRef(int parameterIndex, java.sql.Ref x)
Sets an input parameter to a Ref value.void
setShort(int parameterIndex, short x)
Sets an input parameter to a Java short value.void
setString(int parameterIndex, java.lang.String x)
Sets an input parameter to a String value.void
setTime(int parameterIndex, java.sql.Time x)
Sets an input parameter to a java.sql.Time value using the default calendar.void
setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal)
Sets an input parameter to a java.sql.Time value using a calendar other than the default.void
setTimestamp(int parameterIndex, java.sql.Timestamp x)
Sets an input parameter to a java.sql.Timestamp value using the default calendar.void
setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal)
Sets an input parameter to a java.sql.Timestamp value using a calendar other than the default.void
setUnicodeStream(int parameterIndex, java.io.InputStream x, int length)
Sets an input parameter to a Unicode stream value.void
setURL(int parameterIndex, java.net.URL x)
Sets an input parameter to a URL value.protected void
startCancelThread()
Handles the work involved in supporting a setQueryTimeout option with the cancel property set. .java.lang.String
toString()
Returns the statement name.-
Methods inherited from class com.ibm.as400.access.AS400JDBCStatement
finalize
-
-
-
-
Method Detail
-
addBatch
public void addBatch(java.lang.String sql) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Adds an SQL statement to the current batch of SQL statements.Do not use this form of addBatch() on a prepared statement.
- Specified by:
addBatch
in interfacejava.sql.Statement
- Specified by:
addBatch
in classAS400JDBCPreparedStatement
- 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:
java.sql.SQLException
- This exception is always thrown.
-
cancel
public void cancel() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
cancel
in classAS400JDBCStatement
- Throws:
java.sql.SQLException
- If the statement is not open or an error occurs.
-
clearBatch
public void clearBatch() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Clears the current batch of SQL statements.- Specified by:
clearBatch
in interfacejava.sql.Statement
- Overrides:
clearBatch
in classAS400JDBCStatement
- Throws:
java.sql.SQLException
- If the statement is not open.
-
clearWarnings
public void clearWarnings() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
clearWarnings
in classAS400JDBCStatement
- Throws:
java.sql.SQLException
- If an error occurs.
-
close
public void close() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
close
in classAS400JDBCStatement
- Throws:
java.sql.SQLException
- If an error occurs.
-
execute
public boolean execute(java.lang.String sql) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Runs an SQL statement that may return multiple result sets. This closes the current result set and clears warnings before executing a new SQL statement.Do not use this form of execute() on a prepared statement.
- Specified by:
execute
in interfacejava.sql.Statement
- Specified by:
execute
in classAS400JDBCPreparedStatement
- 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:
java.sql.SQLException
- This exception is always thrown.
-
execute
public boolean execute(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
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.Do not use this form of execute() on a prepared statement.
- Specified by:
execute
in interfacejava.sql.Statement
- Specified by:
execute
in classAS400JDBCPreparedStatement
- 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:
java.sql.SQLException
- This exception is always thrown.
-
execute
public boolean execute(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
execute
in classAS400JDBCStatement
- 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:
java.sql.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.
-
execute
public boolean execute(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
execute
in classAS400JDBCStatement
- 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:
java.sql.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.
-
executeBatch
public int[] executeBatch() throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
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 interfacejava.sql.Statement
- Specified by:
executeBatch
in classAS400JDBCPreparedStatement
- 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:
java.sql.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 java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Runs an SQL statement that returns a single result set. This closes the current result set and clears warnings before executing a new SQL statement.Do not use this form of executeQuery() on a prepared statement.
- Specified by:
executeQuery
in interfacejava.sql.Statement
- Specified by:
executeQuery
in classAS400JDBCPreparedStatement
- Parameters:
sql
- The SQL statement.- Returns:
- The result set that contains the data produced by the query.
- Throws:
java.sql.SQLException
- This exception is always thrown.
-
executeUpdate
public int executeUpdate(java.lang.String sql) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
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 a new SQL statement.Do not use this form of executeUpdate() on a prepared statement.
- Specified by:
executeUpdate
in interfacejava.sql.Statement
- Specified by:
executeUpdate
in classAS400JDBCPreparedStatement
- Parameters:
sql
- The SQL statement.- Returns:
- Either the row count for INSERT, UPDATE, or DELETE, or 0 for SQL statements that return nothing.
- Throws:
java.sql.SQLException
- This exception is always thrown.
-
executeUpdate
public int executeUpdate(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
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.Do not use this form of executeUpdate() on a prepared statement.
- Specified by:
executeUpdate
in interfacejava.sql.Statement
- Specified by:
executeUpdate
in classAS400JDBCPreparedStatement
- Parameters:
sql
- The SQL statement.- Returns:
- Either the row count for INSERT, UPDATE, or DELETE, or 0 for SQL statements that return nothing.
- Throws:
java.sql.SQLException
- This exception is always thrown.
-
executeUpdate
public int executeUpdate(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
executeUpdate
in classAS400JDBCStatement
- 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:
java.sql.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.
-
executeUpdate
public int executeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
executeUpdate
in classAS400JDBCStatement
- 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:
java.sql.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.
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns the connection for this statement.- Specified by:
getConnection
in interfacejava.sql.Statement
- Overrides:
getConnection
in classAS400JDBCStatement
- Returns:
- The connection for this statement.
- Throws:
java.sql.SQLException
- If an error occurs.
-
getFetchDirection
public int getFetchDirection() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns the fetch direction.- Specified by:
getFetchDirection
in interfacejava.sql.Statement
- Overrides:
getFetchDirection
in classAS400JDBCStatement
- Returns:
- The fetch direction.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
getFetchSize
public int getFetchSize() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns the fetch size.- Specified by:
getFetchSize
in interfacejava.sql.Statement
- Overrides:
getFetchSize
in classAS400JDBCStatement
- Returns:
- The fetch size.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
getGeneratedKeys
public java.sql.ResultSet getGeneratedKeys() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Retrieves any auto-generated keys created as a result of executing this Statement object.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 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 interfacejava.sql.Statement
- Overrides:
getGeneratedKeys
in classAS400JDBCStatement
- 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:
java.sql.SQLException
- If the statement is not open, if connecting to OS/400 V5R1 or earlier, an error occurs.
-
getMaxFieldSize
public int getMaxFieldSize() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
getMaxFieldSize
in classAS400JDBCStatement
- Returns:
- The maximum field size limit (in bytes), or 0 for no limit.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
getMaxRows
public int getMaxRows() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
getMaxRows
in classAS400JDBCStatement
- Returns:
- The maximum rows limit, or 0 for no limit.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
getMoreResults
public boolean getMoreResults() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns the next result set. This closes the current result set.- Specified by:
getMoreResults
in interfacejava.sql.Statement
- Overrides:
getMoreResults
in classAS400JDBCStatement
- Returns:
- true if another result set is available, false if there are no more result sets.
- Throws:
java.sql.SQLException
- If an error occurs.
-
getMoreResults
public boolean getMoreResults(int current) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
getMoreResults
in classAS400JDBCStatement
- 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:
java.sql.SQLException
- if DatabaseMetaData.supportsMultipleOpenResults returns false and either Statement.KEEP_CURRENT_RESULT or Statement.CLOSE_ALL_RESULTS are supplied as the argument.
-
getPositionOfSyntaxError
public int getPositionOfSyntaxError() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Will return the value of the last syntax error that came back from the IBM i system.- Overrides:
getPositionOfSyntaxError
in classAS400JDBCStatement
- 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:
java.sql.SQLException
- If the statement is not open.
-
getQueryTimeout
public int getQueryTimeout() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
getQueryTimeout
in classAS400JDBCStatement
- Returns:
- The query timeout limit (in seconds), or 0 for no limit.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
getResultSet
public java.sql.ResultSet getResultSet() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns the current result set.- Specified by:
getResultSet
in interfacejava.sql.Statement
- Overrides:
getResultSet
in classAS400JDBCStatement
- Returns:
- The current result set, or null if an update count was returned or there are no more result sets.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
getResultSetConcurrency
public int getResultSetConcurrency() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns the result set concurrency to be used for this statement.- Specified by:
getResultSetConcurrency
in interfacejava.sql.Statement
- Overrides:
getResultSetConcurrency
in classAS400JDBCStatement
- Returns:
- The result set concurrency.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
getResultSetHoldability
public int getResultSetHoldability() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns the result set cursor holdability to be used for this statement.- Specified by:
getResultSetHoldability
in interfacejava.sql.Statement
- Overrides:
getResultSetHoldability
in classAS400JDBCStatement
- 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.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
getResultSetType
public int getResultSetType() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns the result set type to be used for this statement.- Specified by:
getResultSetType
in interfacejava.sql.Statement
- Overrides:
getResultSetType
in classAS400JDBCStatement
- Returns:
- The result set type.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
getUpdateCount
public int getUpdateCount() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns the current update count.- Specified by:
getUpdateCount
in interfacejava.sql.Statement
- Overrides:
getUpdateCount
in classAS400JDBCStatement
- Returns:
- The update count, or -1 if a result set was returned or there are no more result sets.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns the first warning reported for the statement. Subsequent warnings may be chained to this warning.- Specified by:
getWarnings
in interfacejava.sql.Statement
- Overrides:
getWarnings
in classAS400JDBCStatement
- Returns:
- The first warning, or null if no warnings have been reported.
- Throws:
java.sql.SQLException
- If an error occurs.
-
isClosed
public boolean isClosed() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Indicates if the statement is closed.- Specified by:
isClosed
in interfacejava.sql.Statement
- Overrides:
isClosed
in classAS400JDBCStatement
- Returns:
- true if the statement is closed; false otherwise.
- Throws:
java.sql.SQLException
- If a database error occurs.
-
setCursorName
public void setCursorName(java.lang.String name) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
setCursorName
in classAS400JDBCStatement
- Parameters:
name
- The cursor name. If null, a unique default name will be used.- Throws:
java.sql.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 enable) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
setEscapeProcessing
in classAS400JDBCStatement
- Parameters:
enable
- true to process escape clauses; false otherwise. The default is true.- Throws:
java.sql.SQLException
- If the statement is not open.
-
setFetchDirection
public void setFetchDirection(int direction) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Sets the direction in which the rows in a result set will be processed.This setting is not used.
- Specified by:
setFetchDirection
in interfacejava.sql.Statement
- Overrides:
setFetchDirection
in classAS400JDBCStatement
- Parameters:
direction
- The fetch direction for processing rows. Valid values are:- ResultSet.FETCH_FORWARD
- ResultSet.FETCH_REVERSE
- ResultSet.FETCH_UNKNOWN
- Throws:
java.sql.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 rows) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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".
This setting only takes effect for result sets that are opened after this method has been called. Ideally, this method should be called before the statement is executed.
- Specified by:
setFetchSize
in interfacejava.sql.Statement
- Overrides:
setFetchSize
in classAS400JDBCStatement
- Parameters:
rows
- 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:
java.sql.SQLException
- If the statement is not open or the input value is not valid.
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
setMaxFieldSize
in classAS400JDBCStatement
- Parameters:
max
- The maximum field size limit (in bytes) or 0 for no limit. The default is 0.- Throws:
java.sql.SQLException
- If the statement is not open or the input value is not valid.
-
setMaxRows
public void setMaxRows(int max) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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 interfacejava.sql.Statement
- Overrides:
setMaxRows
in classAS400JDBCStatement
- Parameters:
max
- The maximum rows limit or 0 for no limit. The default is 0.- Throws:
java.sql.SQLException
- If the statement is not open or the input value is not valid.
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
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.This is implemented using the database query time limit, also known as QQRYTIMLMT. This value specifies the query processing time limit that is compared to the estimated number of elapsed seconds that a query must run. The time limit determines if the database query can start.
Beginning with Version 6 Release 1 of IBM i, you must have *JOBCTL special authority.
- Specified by:
setQueryTimeout
in interfacejava.sql.Statement
- Overrides:
setQueryTimeout
in classAS400JDBCStatement
- Parameters:
seconds
- 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:
java.sql.SQLException
- If the statement is not open or the input value is not valid.
-
toString
public java.lang.String toString()
Description copied from class:AS400JDBCStatement
Returns the statement name.- Overrides:
toString
in classAS400JDBCStatement
- Returns:
- The statement name.
-
setPoolable
public void setPoolable(boolean poolable) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Requests that aStatement
be pooled or not pooled. The value specified is a hint to the statement pool implementation indicating whether the applicaiton wants the statement to be pooled. It is up to the statement pool manager as to whether the hint is used.The poolable value of a statement is applicable to both internal statement caches implemented by the driver and external statement caches implemented by application servers and other applications.
By default, a
Statement
is poolable when it is created.- Specified by:
setPoolable
in interfacejava.sql.Statement
- Overrides:
setPoolable
in classAS400JDBCStatement
- Parameters:
poolable
- requests that the statement be pooled if true and that the statement not be pooled if false- Throws:
java.sql.SQLException
- if theStatement
has been closed
-
isPoolable
public boolean isPoolable() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns the value of the statements poolable hint, indicating whether pooling of the statement is requested.- Specified by:
isPoolable
in interfacejava.sql.Statement
- Overrides:
isPoolable
in classAS400JDBCStatement
- Returns:
- The value of the statements poolable hint.
- Throws:
java.sql.SQLException
- if theStatement
has been closedsee java.sql.Statement#setPoolable(boolean) setPoolable(boolean)
-
getValidWrappedList
protected java.lang.String[] getValidWrappedList()
- Overrides:
getValidWrappedList
in classAS400JDBCPreparedStatement
-
closeOnCompletion
public void closeOnCompletion() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Specifies that this Statement will be closed when all its dependent result sets are closed. If execution of the Statement does not produce any result sets, this method has no effect.Note: Multiple calls to closeOnCompletion do not toggle the effect on this Statement. However, a call to closeOnCompletion does effect both the subsequent execution of statements, and statements that currently have open, dependent, result sets.
- Overrides:
closeOnCompletion
in classAS400JDBCStatement
- Throws:
java.sql.SQLException
- - if this method is called on a closed Statement
-
isCloseOnCompletion
public boolean isCloseOnCompletion() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Returns a value indicating whether this Statement will be closed when all its dependent result sets are closed.- Overrides:
isCloseOnCompletion
in classAS400JDBCStatement
- Returns:
- true if the Statement will be closed when all of its dependent result sets are closed; false otherwise
- Throws:
java.sql.SQLException
- - if this method is called on a closed Statement
-
startCancelThread
protected void startCancelThread()
Description copied from class:AS400JDBCStatement
Handles the work involved in supporting a setQueryTimeout option with the cancel property set. .- Overrides:
startCancelThread
in classAS400JDBCStatement
-
endCancelThread
protected void endCancelThread()
Description copied from class:AS400JDBCStatement
endTheCancelThread- Overrides:
endCancelThread
in classAS400JDBCStatement
-
getLargeUpdateCount
public long getLargeUpdateCount() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Retrieves the current result as an update count; if the result is a ResultSet object or there are no more results, -1 is returned. This method should be called only once per result.
This method should be used when the returned row count may exceed Integer.MAX_VALUE.
- Overrides:
getLargeUpdateCount
in classAS400JDBCStatement
- Returns:
- the current result as an update count; -1 if the current result is a ResultSet object or there are no more results
- Throws:
java.sql.SQLException
- - if a database access error occurs or this method is called on a closed Statement
-
setLargeMaxRows
public void setLargeMaxRows(long max) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Sets the limit for the maximum number of rows that any ResultSet object generated by this Statement object can contain to the given number. If the limit is exceeded, the excess rows are silently dropped.
This method should be used when the row limit may exceed Integer.MAX_VALUE.
- Overrides:
setLargeMaxRows
in classAS400JDBCStatement
- Parameters:
max
- the new max rows limit; zero means there is no limit- Throws:
java.sql.SQLException
- - if a database access error occurs, this method is called on a closed Statement or the condition max >= 0 is not satisfied
-
getLargeMaxRows
public long getLargeMaxRows() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Retrieves the maximum number of rows that a ResultSet object produced by this Statement object can contain. If this limit is exceeded, the excess rows are silently dropped.This method should be used when the returned row limit may exceed Integer.MAX_VALUE.
- Overrides:
getLargeMaxRows
in classAS400JDBCStatement
- Returns:
- the current maximum number of rows for a ResultSet object produced by this means there is no limit
- Throws:
java.sql.SQLException
- -if a database access error occurs or this method is called on a closed Statement
-
executeLargeBatch
public long[] executeLargeBatch() throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts. The long elements of the array that is returned are ordered to correspond to the commands in the batch, which are ordered according to the order in which they were added to the batch. The elements in the array returned by the method executeLargeBatch may be one of the following:
A number greater than or equal to zero -- indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution
A value of SUCCESS_NO_INFO -- indicates that the command was processed successfully but that the number of rows affected is unknown.
If one of the commands in a batch update fails to execute properly, this method throws a BatchUpdateException, and a JDBC driver may or may not continue to process the remaining commands in the batch. However, the driver's behavior must be consistent with a particular DBMS, either always continuing to process commands or never continuing to process commands. If the driver continues processing after a failure, the array returned by the method BatchUpdateException.getLargeUpdateCounts will contain as many elements as there are commands in the batch, and at least one of the elements will be the following:
A value of EXECUTE_FAILED -- indicates that the command failed to execute successfully and occurs only if a driver continues to process commands after a command fails
This method should be used when the returned row count may exceed Integer.MAX_VALUE.
- Overrides:
executeLargeBatch
in classAS400JDBCStatement
- Returns:
- an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which commands were added to the batch.
- Throws:
java.sql.SQLException
- - if a database access error occurs, this method is called on a closed Statement or the driver does not support batch statements. Throws BatchUpdateException (a subclass of SQLException) if one of the commands sent to the database fails to execute properly or attempts to return a result set.
-
executeLargeUpdate
public long executeLargeUpdate(java.lang.String sql) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement.This method should be used when the returned row count may exceed Integer.MAX_VALUE.
Note:This method cannot be called on a PreparedStatement or CallableStatement.
- Overrides:
executeLargeUpdate
in classAS400JDBCStatement
- Parameters:
sql
- an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.- Returns:
- either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException
- - if a database access error occurs, this method is called on a closed Statement, the given SQL statement produces a ResultSet object, the method is called on a PreparedStatement or CallableStatement.
-
executeLargeUpdate
public long executeLargeUpdate(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Executes the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval. The driver will ignore the flag if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).This method should be used when the returned row count may exceed Integer.MAX_VALUE.
- Overrides:
executeLargeUpdate
in classAS400JDBCStatement
- Parameters:
sql
- - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.autoGeneratedKeys
- - a flag indicating whether auto-generated keys should be made available for retrieval; one of the following constants: Statement.RETURN_GENERATED_KEYS Statement.NO_GENERATED_KEYS- Returns:
- either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException
- - if a database access error occurs, this method is called on a closed Statement, the given SQL statement returns a ResultSet object, the given constant is not one of those allowed, the method is called on a PreparedStatement or CallableStatement
-
executeLargeUpdate
public long executeLargeUpdate(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).This method should be used when the returned row count may exceed Integer.MAX_VALUE.
Note:This method cannot be called on a PreparedStatement or CallableStatement.
- Overrides:
executeLargeUpdate
in classAS400JDBCStatement
- Parameters:
sql
- - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.columnIndexes
- - an array of column indexes indicating the columns that should be returned from the inserted row- Returns:
- either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException
- - if a database access error occurs, this method is called on a closed Statement, the SQL statement returns a ResultSet object,the second argument supplied to this method is not an int array whose elements are valid column indexes, the method is called on a PreparedStatement or CallableStatement
-
executeLargeUpdate
public long executeLargeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
Description copied from class:AS400JDBCStatement
Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the names of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the SQL statement is not an INSERT statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).This method should be used when the returned row count may exceed Integer.MAX_VALUE.
Note:This method cannot be called on a PreparedStatement or CallableStatement.
- Overrides:
executeLargeUpdate
in classAS400JDBCStatement
- Parameters:
sql
- - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.columnNames
- - an array of the names of the columns that should be returned from the inserted row- Returns:
- either the row count for INSERT, UPDATE, or DELETE statements, or 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException
- if a database access error occurs, this method is called on a closed Statement, the SQL statement returns a ResultSet object, the second argument supplied to this method is not a String array whose elements are valid column names, the method is called on a PreparedStatement or CallableStatement
-
executeQuery
public java.sql.ResultSet executeQuery() throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Runs the SQL statement that returns a single result set. This closes the current result set and clears warnings before executing the SQL statement again.- Specified by:
executeQuery
in interfacejava.sql.PreparedStatement
- Specified by:
executeQuery
in classAS400JDBCPreparedStatement
- Returns:
- The result set that contains the data produced by the query.
- Throws:
java.sql.SQLException
- If the statement is not open, no result set is returned by the database, the query timeout limit is exceeded, an input parameter has not been set, or an error occurs.
-
executeUpdate
public int executeUpdate() throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
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 SQL statement again.- Specified by:
executeUpdate
in interfacejava.sql.PreparedStatement
- Specified by:
executeUpdate
in classAS400JDBCPreparedStatement
- Returns:
- Either the row count for INSERT, UPDATE, or DELETE, or 0 for SQL statements that return nothing.
- Throws:
java.sql.SQLException
- If the statement is not open, the query timeout limit is exceeded, the statement returns a result set, an input parameter has not been set, or an error occurs.
-
setNull
public void setNull(int parameterIndex, int sqlType) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to SQL NULL.- Specified by:
setNull
in interfacejava.sql.PreparedStatement
- Specified by:
setNull
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).sqlType
- The SQL type code defined in java.sql.Types.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, or the SQL type is not valid.
-
setBoolean
public void setBoolean(int parameterIndex, boolean x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Java boolean value. The driver converts this to an SQL SMALLINT value.- Specified by:
setBoolean
in interfacejava.sql.PreparedStatement
- Specified by:
setBoolean
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, or the parameter is not an input parameter.
-
setByte
public void setByte(int parameterIndex, byte x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Java byte value. The driver converts this to an SQL SMALLINT value.- Specified by:
setByte
in interfacejava.sql.PreparedStatement
- Specified by:
setByte
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, or the parameter is not an input parameter.
-
setShort
public void setShort(int parameterIndex, short x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Java short value. The driver converts this to an SQL SMALLINT value.- Specified by:
setShort
in interfacejava.sql.PreparedStatement
- Specified by:
setShort
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid or the parameter is not an input parameter.
-
setInt
public void setInt(int parameterIndex, int x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Java int value. The driver converts this to an SQL INTEGER value.- Specified by:
setInt
in interfacejava.sql.PreparedStatement
- Specified by:
setInt
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid or the parameter is not an input parameter.
-
setLong
public void setLong(int parameterIndex, long x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Java long value. If the connected system supports SQL BIGINT data, the driver converts this to an SQL BIGINT value. Otherwise, the driver converts this to an SQL INTEGER value. SQL BIGINT data is supported on V4R5 and later.- Specified by:
setLong
in interfacejava.sql.PreparedStatement
- Specified by:
setLong
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, or the parameter is not an input parameter.
-
setFloat
public void setFloat(int parameterIndex, float x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Java float value. The driver converts this to an SQL REAL value.- Specified by:
setFloat
in interfacejava.sql.PreparedStatement
- Specified by:
setFloat
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, or the parameter is not an input parameter.
-
setDouble
public void setDouble(int parameterIndex, double x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Java double value. The driver converts this to an SQL DOUBLE value.- Specified by:
setDouble
in interfacejava.sql.PreparedStatement
- Specified by:
setDouble
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid or the parameter is not an input parameter.
-
setBigDecimal
public void setBigDecimal(int parameterIndex, java.math.BigDecimal x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a BigDecimal value. The driver converts this to an SQL NUMERIC value.- Specified by:
setBigDecimal
in interfacejava.sql.PreparedStatement
- Specified by:
setBigDecimal
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, or the parameter is not an input parameter.
-
setString
public void setString(int parameterIndex, java.lang.String x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a String value. The driver converts this to an SQL VARCHAR value.- Specified by:
setString
in interfacejava.sql.PreparedStatement
- Specified by:
setString
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, or the parameter is not an input parameter.
-
setBytes
public void setBytes(int parameterIndex, byte[] x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Java byte array value. The driver converts this to an SQL VARBINARY value.- Specified by:
setBytes
in interfacejava.sql.PreparedStatement
- Specified by:
setBytes
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, or the parameter is not an input parameter.
-
setDate
public void setDate(int parameterIndex, java.sql.Date x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a java.sql.Date value using the default calendar. The driver converts this to an SQL DATE value.- Specified by:
setDate
in interfacejava.sql.PreparedStatement
- Specified by:
setDate
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, or the parameter is not an input parameter.
-
setTime
public void setTime(int parameterIndex, java.sql.Time x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a java.sql.Time value using the default calendar. The driver converts this to an SQL TIME value.- Specified by:
setTime
in interfacejava.sql.PreparedStatement
- Specified by:
setTime
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, or the parameter is not an input parameter.
-
setTimestamp
public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a java.sql.Timestamp value using the default calendar. The driver converts this to an SQL TIMESTAMP value.- Specified by:
setTimestamp
in interfacejava.sql.PreparedStatement
- Specified by:
setTimestamp
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, or the parameter is not an input parameter.
-
setAsciiStream
public void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to an ASCII stream value. The driver reads the data from the stream as needed until no more bytes are available. The driver converts this to an SQL VARCHAR value.- Specified by:
setAsciiStream
in interfacejava.sql.PreparedStatement
- Specified by:
setAsciiStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.length
- The number of bytes in the stream.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, the length is not valid, the input stream does not contain all ASCII characters, or an error occurs while reading the input stream.
-
setUnicodeStream
public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Unicode stream value. The driver reads the data from the stream as needed until no more bytes are available. The driver converts this to an SQL VARCHAR value.Note that the number of bytes in a Unicode stream can be computed as 2 multiplied by the number of characters plus 2 bytes for the byte-order mark. If an uneven number of bytes is specified, then Java will convert this to an empty String.
- Specified by:
setUnicodeStream
in interfacejava.sql.PreparedStatement
- Specified by:
setUnicodeStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.length
- The number of bytes in the stream.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, the length is not valid, the input stream does not contain all Unicode characters, or an error occurs while reading the input stream- See Also:
AS400JDBCPreparedStatement.setCharacterStream(int, java.io.Reader, int)
-
setBinaryStream
public void setBinaryStream(int parameterIndex, java.io.InputStream stream, int length) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a binary stream value. The driver reads the data from the stream as needed until no more bytes are available. The driver converts this to an SQL VARBINARY value.
If a parameter is set using setBinaryStream, then the parameter must be reset prior to the second execute of the PreparedStatement object.- Specified by:
setBinaryStream
in interfacejava.sql.PreparedStatement
- Specified by:
setBinaryStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).stream
- The parameter value or null to set the value to SQL NULL.length
- The number of bytes in the stream.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, the length is not valid, or an error occurs while reading the input stream.
-
clearParameters
public void clearParameters() throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Releases the resources used by the current input parameter values. In general, input parameter values remain in effect for repeated executions of the prepared statement. Setting an input parameter value to a new value automatically clears its previous value.- Specified by:
clearParameters
in interfacejava.sql.PreparedStatement
- Specified by:
clearParameters
in classAS400JDBCPreparedStatement
- Throws:
java.sql.SQLException
- If the statement is not open.
-
setObject
public void setObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to an Object value. The driver converts this to a value with the specified SQL type.
If proxy support is in use, the Object must be serializable.- Specified by:
setObject
in interfacejava.sql.PreparedStatement
- Specified by:
setObject
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.targetSqlType
- The SQL type code defined in java.sql.Types.scale
- The number of digits after the decimal if sqlType is DECIMAL or NUMERIC.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, the SQL type is not valid, the scale is not valid, or the parameter is not serializable (when proxy support is in use).
-
setObject
public void setObject(int parameterIndex, java.lang.Object x, int targetSqlType) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to an Object value. The driver converts this to a value with the specified SQL type.
If proxy support is in use, the Object must be serializable.- Specified by:
setObject
in interfacejava.sql.PreparedStatement
- Specified by:
setObject
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.targetSqlType
- The SQL type code defined in java.sql.Types.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, the SQL type is not valid, or the parameter is not serializable (when proxy support is in use).
-
setObject
public void setObject(int parameterIndex, java.lang.Object x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to an Object value. The driver converts this to a value of an SQL type, depending on the type of the specified value. The JDBC specification defines a standard mapping from Java types to SQL types. In the cases where a SQL type is not supported by DB2 for IBM i, the next closest matching type is used.
If proxy support is in use, the Object must be serializable.- Specified by:
setObject
in interfacejava.sql.PreparedStatement
- Specified by:
setObject
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, the type of value is not supported, or the parameter is not serializable (when proxy support is in use).
-
execute
public boolean execute() throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Runs an SQL statement that may return multiple result sets. This closes the current result set and clears warnings before executing the SQL statement again.Under some situations, a single SQL statement may return multiple result sets, an update count, or both. This might occur either when executing a stored procedure that returns multiple result sets or when dynamically executing an unknown SQL string.
Use Statement.getMoreResults(), Statement.getResultSet(), and Statement.getUpdateCount() to navigate through multiple result sets, an update count, or both.
- Specified by:
execute
in interfacejava.sql.PreparedStatement
- Specified by:
execute
in classAS400JDBCPreparedStatement
- Returns:
- true if a result set was returned; false if an update count was returned or nothing was returned.
- Throws:
java.sql.SQLException
- If the statement is not open, the query timeout limit is exceeded, or an error occurs.
-
addBatch
public void addBatch() throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Adds the set of parameters to the current batch.- Specified by:
addBatch
in interfacejava.sql.PreparedStatement
- Specified by:
addBatch
in classAS400JDBCPreparedStatement
- Throws:
java.sql.SQLException
- If the statement is not open or an input parameter has not been set.
-
setCharacterStream
public void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a character stream value. The driver reads the data from the character stream as needed until no more characters are available. The driver converts this to an SQL VARCHAR value.- Specified by:
setCharacterStream
in interfacejava.sql.PreparedStatement
- Specified by:
setCharacterStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).reader
- The parameter value or null to set the value to SQL NULL.length
- The number of characters to read from the reader.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, the length is not valid, or an error occurs while reading the character stream
-
setRef
public void setRef(int parameterIndex, java.sql.Ref x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Ref value. DB2 for IBM i does not support structured types.- Specified by:
setRef
in interfacejava.sql.PreparedStatement
- Specified by:
setRef
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value.- Throws:
java.sql.SQLException
- Always thrown because DB2 for IBM i does not support structured types.
-
setBlob
public void setBlob(int parameterIndex, java.sql.Blob x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Blob value. The driver converts this to an SQL BLOB value.
If proxy support is in use, the Blob must be serializable.- Specified by:
setBlob
in interfacejava.sql.PreparedStatement
- Specified by:
setBlob
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, or the parameter is not serializable (when proxy support is in use).
-
setClob
public void setClob(int parameterIndex, java.sql.Clob x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a Clob value. The driver converts this to an SQL CLOB value.
If proxy support is in use, the Clob must be serializable.- Specified by:
setClob
in interfacejava.sql.PreparedStatement
- Specified by:
setClob
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, or the parameter is not serializable (when proxy support is in use).
-
setArray
public void setArray(int parameterIndex, java.sql.Array x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to an Array value. DB2 for IBM i only supports arrays in stored procedures.- Specified by:
setArray
in interfacejava.sql.PreparedStatement
- Specified by:
setArray
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value.- Throws:
java.sql.SQLException
- Always thrown because DB2 for IBM i does not support arrays.
-
getMetaData
public java.sql.ResultSetMetaData getMetaData() throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Returns the ResultSetMetaData object that describes the result set's columns. Null is returned if the statement does not return a result set. In the following example rsmd is null since the statement does not return a result set.PreparedStatement ps = connection .prepareStatement("INSERT INTO COLLECTION.TABLE VALUES(?)"); ResultSetMetaData rsmd = ps.getMetaData();
- Specified by:
getMetaData
in interfacejava.sql.PreparedStatement
- Specified by:
getMetaData
in classAS400JDBCPreparedStatement
- Returns:
- The metadata object, or null if the statement does not return a result set.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
setDate
public void setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a java.sql.Date value using a calendar other than the default. The driver converts this to an SQL DATE value.- Specified by:
setDate
in interfacejava.sql.PreparedStatement
- Specified by:
setDate
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.cal
- The calendar.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, or the calendar is null.
-
setTime
public void setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a java.sql.Time value using a calendar other than the default. The driver converts this to an SQL TIME value.- Specified by:
setTime
in interfacejava.sql.PreparedStatement
- Specified by:
setTime
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.cal
- The calendar.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, or the calendar is null.
-
setTimestamp
public void setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a java.sql.Timestamp value using a calendar other than the default. The driver converts this to an SQL TIMESTAMP value.- Specified by:
setTimestamp
in interfacejava.sql.PreparedStatement
- Specified by:
setTimestamp
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.cal
- The calendar.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, or the calendar is null.
-
setNull
public void setNull(int parameterIndex, int sqlType, java.lang.String typeName) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to SQL NULL.- Specified by:
setNull
in interfacejava.sql.PreparedStatement
- Specified by:
setNull
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).sqlType
- The SQL type code defined in java.sql.Types.typeName
- The fully-qualified name of an SQL structured type. This value will be ignored.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter, or the SQL type is not valid.
-
setURL
public void setURL(int parameterIndex, java.net.URL x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to a URL value. The driver converts this to an SQL DATALINK value.- Specified by:
setURL
in interfacejava.sql.PreparedStatement
- Specified by:
setURL
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- The parameter value or null to set the value to SQL NULL.- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, or the parameter is not an input parameter.
-
getParameterMetaData
public java.sql.ParameterMetaData getParameterMetaData() throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Returns the number, types, and properties of a PreparedStatement object's parameters.- Specified by:
getParameterMetaData
in interfacejava.sql.PreparedStatement
- Specified by:
getParameterMetaData
in classAS400JDBCPreparedStatement
- Returns:
- The ParameterMetaData object that describes this prepared statement object.
- Throws:
java.sql.SQLException
- If the statement is not open.
-
setNClob
public void setNClob(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to aReader
object. This method differs from thesetCharacterStream (int, Reader)
method because it informs the driver that the parameter value should be sent to the server as aNCLOB
. When thesetCharacterStream
method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGNVARCHAR
or aNCLOB
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version of
setNClob
which takes a length parameter.- Specified by:
setNClob
in interfacejava.sql.PreparedStatement
- Specified by:
setNClob
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).reader
- An object that contains the data to set the parameter value to.- Throws:
java.sql.SQLException
- If a database error occurs. if parameterIndex does not correspond to a parameter marker in the SQL statement; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs or this method is called on a closedPreparedStatement
-
setAsciiStream
public void setAsciiStream(int parameterIndex, java.io.InputStream stream) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to the given input stream. When a very large ASCII value is input to aLONGVARCHAR
parameter, it may be more practical to send it via ajava.io.InputStream
. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
- Specified by:
setAsciiStream
in interfacejava.sql.PreparedStatement
- Specified by:
setAsciiStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).stream
- the Java input stream that contains the ASCII parameter value- Throws:
java.sql.SQLException
- if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closedPreparedStatement
-
setAsciiStream
public void setAsciiStream(int parameterIndex, java.io.InputStream stream, long length) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large ASCII value is input to aLONGVARCHAR
parameter, it may be more practical to send it via ajava.io.InputStream
. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
- Specified by:
setAsciiStream
in interfacejava.sql.PreparedStatement
- Specified by:
setAsciiStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).stream
- the Java input stream that contains the ASCII parameter valuelength
- the number of bytes in the stream- Throws:
java.sql.SQLException
- if a database access error occurs or this method is called on a closedPreparedStatement
-
setBinaryStream
public void setBinaryStream(int parameterIndex, java.io.InputStream stream) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to the given input stream. When a very large binary value is input to aLONGVARBINARY
parameter, it may be more practical to send it via ajava.io.InputStream
object. The data will be read from the stream as needed until end-of-file is reached.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
- Specified by:
setBinaryStream
in interfacejava.sql.PreparedStatement
- Specified by:
setBinaryStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).stream
- the java input stream which contains the binary parameter value- Throws:
java.sql.SQLException
- if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closedPreparedStatement
-
setBinaryStream
public void setBinaryStream(int parameterIndex, java.io.InputStream stream, long length) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large binary value is input to aLONGVARBINARY
parameter, it may be more practical to send it via ajava.io.InputStream
object. The data will be read from the stream as needed until end-of-file is reached.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
- Specified by:
setBinaryStream
in interfacejava.sql.PreparedStatement
- Specified by:
setBinaryStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).stream
- the java input stream which contains the binary parameter valuelength
- the number of bytes in the stream- Throws:
java.sql.SQLException
- if a database access error occurs or this method is called on a closedPreparedStatement
-
setBlob
public void setBlob(int parameterIndex, java.io.InputStream stream) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to aInputStream
object. This method differs from thesetBinaryStream (int, InputStream)
method because it informs the driver that the parameter value should be sent to the server as aBLOB
. When thesetBinaryStream
method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARBINARY
or aBLOB
- Specified by:
setBlob
in interfacejava.sql.PreparedStatement
- Specified by:
setBlob
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).stream
- An object that contains the data to set the parameter value to.- Throws:
java.sql.SQLException
- If a database error occurs. if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs; this method is called on a closedPreparedStatement
or if parameterIndex does not correspond to a parameter marker in the SQL statement,
-
setBlob
public void setBlob(int parameterIndex, java.io.InputStream stream, long length) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to anInputStream
object. The inputStream must contain the number of characters specified by length otherwise aSQLException
will be generated when thePreparedStatement
is executed.- Specified by:
setBlob
in interfacejava.sql.PreparedStatement
- Specified by:
setBlob
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).stream
- An object that contains the data to set the parameter value to.length
- the number of bytes in the parameter data.- Throws:
java.sql.SQLException
- If a database error occurs. if parameterIndex does not correspond to a parameter marker in the SQL statement, if the length specified is less than zero or if the number of bytes in the inputstream does not match the specfied length.
-
setCharacterStream
public void setCharacterStream(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to the givenReader
object. When a very large UNICODE value is input to aLONGVARCHAR
parameter, it may be more practical to send it via ajava.io.Reader
object. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version of
setCharacterStream
which takes a length parameter.- Specified by:
setCharacterStream
in interfacejava.sql.PreparedStatement
- Specified by:
setCharacterStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).reader
- thejava.io.Reader
object that contains the Unicode data- Throws:
java.sql.SQLException
- if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closedPreparedStatement
-
setCharacterStream
public void setCharacterStream(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to the givenReader
object, which is the given number of characters long. When a very large UNICODE value is input to aLONGVARCHAR
parameter, it may be more practical to send it via ajava.io.Reader
object. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
- Specified by:
setCharacterStream
in interfacejava.sql.PreparedStatement
- Specified by:
setCharacterStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).reader
- thejava.io.Reader
object that contains the Unicode datalength
- the number of characters in the stream- Throws:
java.sql.SQLException
- if a database access error occurs or this method is called on a closedPreparedStatement
-
setClob
public void setClob(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to aReader
object. This method differs from thesetCharacterStream (int, Reader)
method because it informs the driver that the parameter value should be sent to the server as aCLOB
. When thesetCharacterStream
method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as aLONGVARCHAR
or aCLOB
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version of
setClob
which takes a length parameter.- Specified by:
setClob
in interfacejava.sql.PreparedStatement
- Specified by:
setClob
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).reader
- An object that contains the data to set the parameter value to.- Throws:
java.sql.SQLException
- If a database error occurs. if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs; this method is called on a closedPreparedStatement
or if parameterIndex does not correspond to a parameter marker in the SQL statement
-
setClob
public void setClob(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to aReader
object. The reader must contain the number of characters specified by length otherwise aSQLException
will be generated when thePreparedStatement
is executed.- Specified by:
setClob
in interfacejava.sql.PreparedStatement
- Specified by:
setClob
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).reader
- An object that contains the data to set the parameter value to.length
- the number of characters in the parameter data.- Throws:
java.sql.SQLException
- If a database error occurs. if parameterIndex does not correspond to a parameter marker in the SQL statement, or if the length specified is less than zero.
-
setNCharacterStream
public void setNCharacterStream(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to aReader
object. TheReader
reads the data till end-of-file is reached. The driver does the necessary conversion from Java character format to the national character set in the database.Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
Note: Consult your JDBC driver documentation to determine if it might be more efficient to use a version of
setNCharacterStream
which takes a length parameter.- Specified by:
setNCharacterStream
in interfacejava.sql.PreparedStatement
- Specified by:
setNCharacterStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).reader
- the parameter value- Throws:
java.sql.SQLException
- If a database error occurs. if parameterIndex does not correspond to a parameter marker in the SQL statement; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; if a database access error occurs; or this method is called on a closedPreparedStatement
-
setNCharacterStream
public void setNCharacterStream(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to aReader
object. TheReader
reads the data till end-of-file is reached. The driver does the necessary conversion from Java character format to the national character set in the database.- Specified by:
setNCharacterStream
in interfacejava.sql.PreparedStatement
- Specified by:
setNCharacterStream
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).reader
- the parameter valuelength
- the number of characters in the parameter data.- Throws:
java.sql.SQLException
- If a database error occurs. if the driver does not support national character sets; if the driver can detect that a data conversion error could occur ; or if a database access error occurs
-
setNClob
public void setNClob(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated parameter to aReader
object. The reader must contain the number of characters specified by length otherwise aSQLException
will be generated when thePreparedStatement
is executed.- Specified by:
setNClob
in interfacejava.sql.PreparedStatement
- Specified by:
setNClob
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).reader
- An object that contains the data to set the parameter value to.length
- the number of characters in the parameter data.- Throws:
java.sql.SQLException
- If a database error occurs. if parameterIndex does not correspond to a parameter marker in the SQL statement; if the length specified is less than zero; if the driver does not support national character sets; if the driver can detect that a data conversion error could occur; or if a database access error occurs
-
setNString
public void setNString(int parameterIndex, java.lang.String x) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the designated paramter to the givenString
object. The driver converts this to a SQLNCHAR
orNVARCHAR
orLONGNVARCHAR
value (depending on the argument's size relative to the driver's limits onNVARCHAR
values) when it sends it to the database.- Specified by:
setNString
in interfacejava.sql.PreparedStatement
- Specified by:
setNString
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).x
- the parameter value- Throws:
java.sql.SQLException
- If a database error occurs. if the driver does not support national character sets; if the driver can detect that a data conversion error could occur ; or if a database access error occurs
-
setDB2Default
public void setDB2Default(int parameterIndex) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to the default value- Specified by:
setDB2Default
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter.
-
setDBDefault
public void setDBDefault(int parameterIndex) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to the default value. This is a the same as setDB2Default.- Specified by:
setDBDefault
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter.
-
setDB2Unassigned
public void setDB2Unassigned(int parameterIndex) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to unassigned- Specified by:
setDB2Unassigned
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter.
-
setDBUnassigned
public void setDBUnassigned(int parameterIndex) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets an input parameter to unassigned. This is a the same as setDB2Unassigned.- Specified by:
setDBUnassigned
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- The parameter index (1-based).- Throws:
java.sql.SQLException
- If the statement is not open, the index is not valid, the parameter is not an input parameter.
-
getDB2ParameterName
public java.lang.String getDB2ParameterName(int parm) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Return the name of the parameter for a stored procedure call.- Specified by:
getDB2ParameterName
in classAS400JDBCPreparedStatement
- Parameters:
parm
- the parameter number to get the name for- Returns:
- the parameter name.
- Throws:
java.sql.SQLException
- If a database error occurs.
-
setObject
public void setObject(int parameterIndex, java.lang.Object x, java.lang.Object targetSqlType, int scaleOrLength) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the value of the designated parameter with the given object. If the second argument is an InputStream then the stream must contain the number of bytes specified by scaleOrLength. If the second argument is a Reader then the reader must contain the number of characters specified by scaleOrLength. If these conditions are not true the driver will generate a SQLException when the prepared statement is executed.The given Java object will be converted to the given targetSqlType before being sent to the database. If the object has a custom mapping (is of a class implementing the interface SQLData), the JDBC driver should call the method SQLData.writeSQL to write it to the SQL data stream. If, on the other hand, the object is of a class implementing Ref, Blob, Clob, NClob, Struct, java.net.URL, or Array, the driver should pass it to the database as a value of the corresponding SQL type.
Note that this method may be used to pass database-specific abstract data types.
- Specified by:
setObject
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- - the first parameter is 1, the second is 2, ...x
- - the object containing the input parameter valuetargetSqlType
- - the SQL type to be sent to the database. The scale argument may further qualify this type.scaleOrLength
- - for java.sql.JDBCType.DECIMAL or java.sql.JDBCType.NUMERIC types, this is the number of digits after the decimal point. For Java Object types InputStream and Reader, this is the length of the data in the stream or reader. For all other types, this value will be ignored.- Throws:
java.sql.SQLException
- - if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement or if the Java Object specified by x is an InputStream or Reader object and the value of the scale parameter is less than zero
-
setObject
public void setObject(int parameterIndex, java.lang.Object x, java.lang.Object targetSqlType) throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Sets the value of the designated parameter with the given object. This method is similar to setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength), except that it assumes a scale of zero.- Specified by:
setObject
in classAS400JDBCPreparedStatement
- Parameters:
parameterIndex
- - the first parameter is 1, the second is 2, ...x
- - the object containing the input parameter valuetargetSqlType
- - the SQL type to be sent to the database parameterIndex- Throws:
java.sql.SQLException
- - if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed PreparedStatement
-
executeLargeUpdate
public long executeLargeUpdate() throws java.sql.SQLException
Description copied from class:AS400JDBCPreparedStatement
Executes the SQL statement in this PreparedStatement object, which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.This method should be used when the returned row count may exceed Integer.MAX_VALUE.
- Specified by:
executeLargeUpdate
in classAS400JDBCPreparedStatement
- Returns:
- either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException
- - if a database access error occurs; this method is called on a closed PreparedStatement or the SQL statement returns a ResultSet object
-
-