AutoCloseable, PreparedStatement, Statement, WrapperAS400JDBCCallableStatementRedirectpublic class AS400JDBCPreparedStatementRedirect extends AS400JDBCPreparedStatement
extendedColumnDescriptors_CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO| Modifier and Type | Method | Description |
|---|---|---|
void |
addBatch() |
Adds the set of parameters to the current batch.
|
void |
addBatch(String sql) |
Adds an SQL statement to the current batch of SQL statements.
|
void |
cancel() |
Cancels the statement.
|
void |
clearBatch() |
Clears the current batch of SQL statements.
|
void |
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() |
endTheCancelThread
|
boolean |
execute() |
Runs an SQL statement that may return multiple result sets.
|
boolean |
execute(String sql) |
Runs an SQL statement that may return multiple result sets.
|
boolean |
execute(String sql,
int autoGeneratedKeys) |
Runs an SQL statement that may return multiple result sets and makes any
auto-generated keys available for retrieval using
Statement.getGeneratedKeys().
|
boolean |
execute(String sql,
int[] columnIndexes) |
Runs an SQL statement that may return multiple result sets and
makes any auto-generated keys for the columns indicated in the given array
available for retrieval using Statement.getGeneratedKeys().
|
boolean |
execute(String sql,
String[] columnNames) |
Runs an SQL statement that may return multiple result sets and
makes any auto-generated keys for the columns indicated in the given array
available for retrieval using Statement.getGeneratedKeys().
|
int[] |
executeBatch() |
Runs the batch of SQL statements.
|
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(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(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(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(String sql,
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.
|
ResultSet |
executeQuery() |
Runs the SQL statement that returns a single result set.
|
ResultSet |
executeQuery(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(String sql) |
Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that
does not return a result set.
|
int |
executeUpdate(String sql,
int autoGeneratedKeys) |
Runs an SQL INSERT, UPDATE, or DELETE statement, or any SQL statement that
does not return a result set and makes any auto-generated keys available
for retrieval using Statement.getGeneratedKeys().
|
int |
executeUpdate(String sql,
int[] columnIndexes) |
Runs an SQL INSERT, UPDATE, or DELETE statement, or any
SQL statement that does not return a result set and
makes any auto-generated keys for the columns indicated in the given array
available for retrieval using Statement.getGeneratedKeys().
|
int |
executeUpdate(String sql,
String[] columnNames) |
Runs an SQL INSERT, UPDATE, or DELETE statement, or any
SQL statement that does not return a result set and
makes any auto-generated keys for the columns indicated in the given array
available for retrieval using Statement.getGeneratedKeys().
|
Connection |
getConnection() |
Returns the connection for this statement.
|
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.
|
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.
|
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.
|
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.
|
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 String[] |
getValidWrappedList() |
|
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.
|
boolean |
isWrapperFor(Class<?> iface) |
Returns true if this either implements the interface argument or is
directly or indirectly a wrapper for an object that does.
|
void |
setArray(int parameterIndex,
Array x) |
Sets an input parameter to an Array value.
|
void |
setAsciiStream(int parameterIndex,
InputStream stream) |
Sets the designated parameter to the given input stream.
|
void |
setAsciiStream(int parameterIndex,
InputStream x,
int length) |
Sets an input parameter to an ASCII stream value.
|
void |
setAsciiStream(int parameterIndex,
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,
BigDecimal x) |
Sets an input parameter to a BigDecimal value.
|
void |
setBinaryStream(int parameterIndex,
InputStream stream) |
Sets the designated parameter to the given input stream.
|
void |
setBinaryStream(int parameterIndex,
InputStream stream,
int length) |
Sets an input parameter to a binary stream value.
|
void |
setBinaryStream(int parameterIndex,
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,
InputStream stream) |
Sets the designated parameter to a
InputStream object. |
void |
setBlob(int parameterIndex,
InputStream stream,
long length) |
Sets the designated parameter to an
InputStream object. |
void |
setBlob(int parameterIndex,
Blob x) |
Sets an input parameter to a Blob value.
|
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,
Reader reader) |
Sets the designated parameter to the given
Reader object. |
void |
setCharacterStream(int parameterIndex,
Reader reader,
int length) |
Sets an input parameter to a character stream value.
|
void |
setCharacterStream(int parameterIndex,
Reader reader,
long length) |
Sets the designated parameter to the given
Reader object,
which is the given number of characters long. |
void |
setClob(int parameterIndex,
Reader reader) |
Sets the designated parameter to a
Reader object. |
void |
setClob(int parameterIndex,
Reader reader,
long length) |
Sets the designated parameter to a
Reader object. |
void |
setClob(int parameterIndex,
Clob x) |
Sets an input parameter to a Clob value.
|
void |
setCursorName(String name) |
Sets the SQL cursor name that will be used by the statement.
|
void |
setDate(int parameterIndex,
Date x) |
Sets an input parameter to a java.sql.Date value using the default
calendar.
|
void |
setDate(int parameterIndex,
Date x,
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 value
|
void |
setDB2Unassigned(int parameterIndex) |
Sets an input parameter to unassigned
|
void |
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,
Reader reader) |
Sets the designated parameter to a
Reader object. |
void |
setNCharacterStream(int parameterIndex,
Reader reader,
long length) |
Sets the designated parameter to a
Reader object. |
void |
setNClob(int parameterIndex,
Reader reader) |
Sets the designated parameter to a
Reader object. |
void |
setNClob(int parameterIndex,
Reader reader,
long length) |
Sets the designated parameter to a
Reader object. |
void |
setNClob(int parameterIndex,
NClob clob) |
Sets the designated parameter to a
java.sql.NClob object. |
void |
setNString(int parameterIndex,
String x) |
Sets the designated paramter to the given
String object. |
void |
setNull(int parameterIndex,
int sqlType) |
Sets an input parameter to SQL NULL.
|
void |
setNull(int parameterIndex,
int sqlType,
String typeName) |
Sets an input parameter to SQL NULL.
|
void |
setObject(int parameterIndex,
Object x) |
Sets an input parameter to an Object value.
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType) |
Sets an input parameter to an Object value.
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType,
int scale) |
Sets an input parameter to an Object value.
|
void |
setObject(int parameterIndex,
Object x,
SQLType targetSqlType) |
Sets the value of the designated parameter with the given object.
|
void |
setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
int scaleOrLength) |
Sets the value of the designated parameter with the given object.
|
void |
setPoolable(boolean poolable) |
Requests that a
Statement be pooled or not pooled. |
void |
setQueryTimeout(int seconds) |
Sets the query timeout limit.
|
void |
setRef(int parameterIndex,
Ref x) |
Sets an input parameter to a Ref value.
|
void |
setRowId(int parameterIndex,
RowId x) |
Sets the designated parameter to the given
java.sql.RowId object. |
void |
setShort(int parameterIndex,
short x) |
Sets an input parameter to a Java short value.
|
void |
setSQLXML(int parameterIndex,
SQLXML xml) |
Sets the designated parameter to the given
java.sql.SQLXML object. |
void |
setString(int parameterIndex,
String x) |
Sets an input parameter to a String value.
|
void |
setTime(int parameterIndex,
Time x) |
Sets an input parameter to a java.sql.Time value using the default
calendar.
|
void |
setTime(int parameterIndex,
Time x,
Calendar cal) |
Sets an input parameter to a java.sql.Time value using a calendar other
than the default.
|
void |
setTimestamp(int parameterIndex,
Timestamp x) |
Sets an input parameter to a java.sql.Timestamp value using the default
calendar.
|
void |
setTimestamp(int parameterIndex,
Timestamp x,
Calendar cal) |
Sets an input parameter to a java.sql.Timestamp value using a calendar
other than the default.
|
void |
setUnicodeStream(int parameterIndex,
InputStream x,
int length) |
Sets an input parameter to a Unicode stream value.
|
void |
setURL(int parameterIndex,
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.
|
String |
toString() |
Returns the statement name.
|
<T> T |
unwrap(Class<T> iface) |
Returns an object that implements the given interface to allow access to
non-standard methods, or standard methods not exposed by the proxy.
|
finalizeclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitenquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, isSimpleIdentifierisWrapperFor, unwrappublic void addBatch(String sql) throws SQLException
AS400JDBCPreparedStatementDo not use this form of addBatch() on a prepared statement.
addBatch in interface StatementaddBatch in class AS400JDBCPreparedStatementsql - The SQL statement to be added to the current batch. This can be
any SQL statement that does not return a result set.SQLException - This exception is always thrown.public void cancel()
throws SQLException
AS400JDBCStatementcancel in interface Statementcancel in class AS400JDBCStatementSQLException - If the statement is not open or
an error occurs.public void clearBatch()
throws SQLException
AS400JDBCStatementclearBatch in interface StatementclearBatch in class AS400JDBCStatementSQLException - If the statement is not open.public void clearWarnings()
throws SQLException
AS400JDBCStatementclearWarnings in interface StatementclearWarnings in class AS400JDBCStatementSQLException - If an error occurs.public void close()
throws SQLException
AS400JDBCStatementclose in interface AutoCloseableclose in interface Statementclose in class AS400JDBCStatementSQLException - If an error occurs.public boolean execute(String sql) throws SQLException
AS400JDBCPreparedStatementDo not use this form of execute() on a prepared statement.
execute in interface Statementexecute in class AS400JDBCPreparedStatementsql - The SQL statement.SQLException - This exception is always thrown.public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
AS400JDBCPreparedStatementDo not use this form of execute() on a prepared statement.
execute in interface Statementexecute in class AS400JDBCPreparedStatementsql - 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.SQLException - This exception is always thrown.public boolean execute(String sql, int[] columnIndexes) throws SQLException
AS400JDBCStatementUnder 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.
execute in interface Statementexecute in class AS400JDBCStatementsql - The SQL statement.columnIndexes - Indicates that auto-generated keys for the indicated
columns should be made available for retrieval.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.public boolean execute(String sql, String[] columnNames) throws SQLException
AS400JDBCStatementUnder 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.
execute in interface Statementexecute in class AS400JDBCStatementsql - The SQL statement.columnNames - Indicates that auto-generated keys for the indicated
columns should be made available for retrieval.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.public int[] executeBatch()
throws SQLException
AS400JDBCPreparedStatementWhen 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.
executeBatch in interface StatementexecuteBatch in class AS400JDBCPreparedStatementSQLException - 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.public ResultSet executeQuery(String sql) throws SQLException
AS400JDBCPreparedStatementDo not use this form of executeQuery() on a prepared statement.
executeQuery in interface StatementexecuteQuery in class AS400JDBCPreparedStatementsql - The SQL statement.SQLException - This exception is always thrown.public int executeUpdate(String sql) throws SQLException
AS400JDBCPreparedStatementDo not use this form of executeUpdate() on a prepared statement.
executeUpdate in interface StatementexecuteUpdate in class AS400JDBCPreparedStatementsql - The SQL statement.SQLException - This exception is always thrown.public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
AS400JDBCPreparedStatementDo not use this form of executeUpdate() on a prepared statement.
executeUpdate in interface StatementexecuteUpdate in class AS400JDBCPreparedStatementsql - The SQL statement.SQLException - This exception is always thrown.public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
AS400JDBCStatementThis method is not supported when connecting to IBM i V5R4 or earlier systems.
executeUpdate in interface StatementexecuteUpdate in class AS400JDBCStatementsql - The SQL statement.columnIndexes - The indexes of columns for which auto-generated keys should be made
available for retrieval.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.public int executeUpdate(String sql, String[] columnNames) throws SQLException
AS400JDBCStatementThis method is not supported when connecting to IBM i V5R4 or earlier systems.
executeUpdate in interface StatementexecuteUpdate in class AS400JDBCStatementsql - The SQL statement.columnNames - The column names for which auto-generated keys should be made
available for retrieval.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.public Connection getConnection() throws SQLException
AS400JDBCStatementgetConnection in interface StatementgetConnection in class AS400JDBCStatementSQLException - If an error occurs.public int getFetchDirection()
throws SQLException
AS400JDBCStatementgetFetchDirection in interface StatementgetFetchDirection in class AS400JDBCStatementSQLException - If the statement is not open.public int getFetchSize()
throws SQLException
AS400JDBCStatementgetFetchSize in interface StatementgetFetchSize in class AS400JDBCStatementSQLException - If the statement is not open.public ResultSet getGeneratedKeys() throws SQLException
AS400JDBCStatementIn 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.
getGeneratedKeys in interface StatementgetGeneratedKeys in class AS400JDBCStatementSQLException - If the statement is not open,
if connecting to OS/400 V5R1 or earlier,
an error occurs.public int getMaxFieldSize()
throws SQLException
AS400JDBCStatementgetMaxFieldSize in interface StatementgetMaxFieldSize in class AS400JDBCStatementSQLException - If the statement is not open.public int getMaxRows()
throws SQLException
AS400JDBCStatementgetMaxRows in interface StatementgetMaxRows in class AS400JDBCStatementSQLException - If the statement is not open.public boolean getMoreResults()
throws SQLException
AS400JDBCStatementgetMoreResults in interface StatementgetMoreResults in class AS400JDBCStatementSQLException - If an error occurs.public boolean getMoreResults(int current)
throws SQLException
AS400JDBCStatementgetMoreResults in interface StatementgetMoreResults in class AS400JDBCStatementcurrent - 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.SQLException - if DatabaseMetaData.supportsMultipleOpenResults returns false
and either Statement.KEEP_CURRENT_RESULT or Statement.CLOSE_ALL_RESULTS are
supplied as the argument.public int getPositionOfSyntaxError()
throws SQLException
AS400JDBCStatementgetPositionOfSyntaxError in class AS400JDBCStatementSQLException - If the statement is not open.public int getQueryTimeout()
throws SQLException
AS400JDBCStatementgetQueryTimeout in interface StatementgetQueryTimeout in class AS400JDBCStatementSQLException - If the statement is not open.public ResultSet getResultSet() throws SQLException
AS400JDBCStatementgetResultSet in interface StatementgetResultSet in class AS400JDBCStatementSQLException - If the statement is not open.public int getResultSetConcurrency()
throws SQLException
AS400JDBCStatementgetResultSetConcurrency in interface StatementgetResultSetConcurrency in class AS400JDBCStatementSQLException - If the statement is not open.public int getResultSetHoldability()
throws SQLException
AS400JDBCStatementgetResultSetHoldability in interface StatementgetResultSetHoldability in class AS400JDBCStatement cursor hold
driver property.SQLException - If the statement is not open.public int getResultSetType()
throws SQLException
AS400JDBCStatementgetResultSetType in interface StatementgetResultSetType in class AS400JDBCStatementSQLException - If the statement is not open.public int getUpdateCount()
throws SQLException
AS400JDBCStatementgetUpdateCount in interface StatementgetUpdateCount in class AS400JDBCStatementSQLException - If the statement is not open.public SQLWarning getWarnings() throws SQLException
AS400JDBCStatementgetWarnings in interface StatementgetWarnings in class AS400JDBCStatementSQLException - If an error occurs.public boolean isClosed()
throws SQLException
AS400JDBCStatementisClosed in interface StatementisClosed in class AS400JDBCStatementSQLException - If a database error occurs.public void setCursorName(String name) throws SQLException
AS400JDBCStatementThe 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.
setCursorName in interface StatementsetCursorName in class AS400JDBCStatementname - The cursor name. If null, a unique
default name will be used.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.public void setEscapeProcessing(boolean enable)
throws SQLException
AS400JDBCStatementsetEscapeProcessing in interface StatementsetEscapeProcessing in class AS400JDBCStatementenable - true to process escape clauses;
false otherwise. The default
is true.SQLException - If the statement is not open.public void setFetchDirection(int direction)
throws SQLException
AS400JDBCStatementThis setting is not used.
setFetchDirection in interface StatementsetFetchDirection in class AS400JDBCStatementdirection - The fetch direction for processing rows.
Valid values are:
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.public void setFetchSize(int rows)
throws SQLException
AS400JDBCStatementThis 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.
setFetchSize in interface StatementsetFetchSize in class AS400JDBCStatementrows - 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.SQLException - If the statement is not open
or the input value is not valid.public void setMaxFieldSize(int max)
throws SQLException
AS400JDBCStatementsetMaxFieldSize in interface StatementsetMaxFieldSize in class AS400JDBCStatementmax - The maximum field size limit (in bytes) or
0 for no limit. The default is 0.SQLException - If the statement is not open
or the input value is not valid.public void setMaxRows(int max)
throws SQLException
AS400JDBCStatementsetMaxRows in interface StatementsetMaxRows in class AS400JDBCStatementmax - The maximum rows limit or 0 for no limit.
The default is 0.SQLException - If the statement is not open
or the input value is not valid.public void setQueryTimeout(int seconds)
throws SQLException
AS400JDBCStatementThis 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.
setQueryTimeout in interface StatementsetQueryTimeout in class AS400JDBCStatementseconds - 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.SQLException - If the statement is not open
or the input value is not valid.public String toString()
AS400JDBCStatementtoString in class AS400JDBCStatementpublic void setPoolable(boolean poolable)
throws SQLException
AS400JDBCStatementStatement 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.
setPoolable in interface StatementsetPoolable in class AS400JDBCStatementpoolable - requests that the statement be pooled if true and
that the statement not be pooled if false
SQLException - if the Statement has been closedpublic boolean isPoolable()
throws SQLException
AS400JDBCStatementisPoolable in interface StatementisPoolable in class AS400JDBCStatementSQLException - if the Statement has been closed
see java.sql.Statement#setPoolable(boolean) setPoolable(boolean)
protected String[] getValidWrappedList()
getValidWrappedList in class AS400JDBCPreparedStatementpublic void closeOnCompletion()
throws SQLException
AS400JDBCStatementNote: 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.
closeOnCompletion in interface StatementcloseOnCompletion in class AS400JDBCStatementSQLException - - if this method is called on a closed Statementpublic boolean isCloseOnCompletion()
throws SQLException
AS400JDBCStatementisCloseOnCompletion in interface StatementisCloseOnCompletion in class AS400JDBCStatementSQLException - - if this method is called on a closed Statementprotected void startCancelThread()
AS400JDBCStatementstartCancelThread in class AS400JDBCStatementprotected void endCancelThread()
AS400JDBCStatementendCancelThread in class AS400JDBCStatementpublic long getLargeUpdateCount()
throws SQLException
AS400JDBCStatementRetrieves 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.
getLargeUpdateCount in interface StatementgetLargeUpdateCount in class AS400JDBCStatementSQLException - - if a database access error occurs or this method is
called on a closed Statementpublic void setLargeMaxRows(long max)
throws SQLException
AS400JDBCStatementSets 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.
setLargeMaxRows in interface StatementsetLargeMaxRows in class AS400JDBCStatementmax - the new max rows limit; zero means there is no limitSQLException - - if a database access error occurs, this
method is called on a closed Statement or the
condition max >= 0 is not satisfiedpublic long getLargeMaxRows()
throws SQLException
AS400JDBCStatementThis method should be used when the returned row limit may exceed Integer.MAX_VALUE.
getLargeMaxRows in interface StatementgetLargeMaxRows in class AS400JDBCStatementSQLException - -if a database access error occurs or this method is
called on a closed Statementpublic long[] executeLargeBatch()
throws SQLException
AS400JDBCStatementSubmits 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.
executeLargeBatch in interface StatementexecuteLargeBatch in class AS400JDBCStatementSQLException - - 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.public long executeLargeUpdate(String sql) throws SQLException
AS400JDBCStatementThis 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.
executeLargeUpdate in interface StatementexecuteLargeUpdate in class AS400JDBCStatementsql - 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.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.public long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLException
AS400JDBCStatementThis method should be used when the returned row count may exceed Integer.MAX_VALUE.
executeLargeUpdate in interface StatementexecuteLargeUpdate in class AS400JDBCStatementsql - - 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_KEYSSQLException - - 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 CallableStatementpublic long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException
AS400JDBCStatementThis 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.
executeLargeUpdate in interface StatementexecuteLargeUpdate in class AS400JDBCStatementsql - - 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 rowSQLException - - 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 CallableStatementpublic long executeLargeUpdate(String sql, String[] columnNames) throws SQLException
AS400JDBCStatementThis 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.
executeLargeUpdate in interface StatementexecuteLargeUpdate in class AS400JDBCStatementsql - - 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 rowSQLException - 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 CallableStatementpublic ResultSet executeQuery() throws SQLException
AS400JDBCPreparedStatementexecuteQuery in interface PreparedStatementexecuteQuery in class AS400JDBCPreparedStatementSQLException - 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.public int executeUpdate()
throws SQLException
AS400JDBCPreparedStatementexecuteUpdate in interface PreparedStatementexecuteUpdate in class AS400JDBCPreparedStatementSQLException - 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.public void setNull(int parameterIndex,
int sqlType)
throws SQLException
AS400JDBCPreparedStatementsetNull in interface PreparedStatementsetNull in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).sqlType - The SQL type code defined in java.sql.Types.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.public void setBoolean(int parameterIndex,
boolean x)
throws SQLException
AS400JDBCPreparedStatementsetBoolean in interface PreparedStatementsetBoolean in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value.SQLException - If the statement is not open, the index is not valid, or the
parameter is not an input parameter.public void setByte(int parameterIndex,
byte x)
throws SQLException
AS400JDBCPreparedStatementsetByte in interface PreparedStatementsetByte in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value.SQLException - If the statement is not open, the index is not valid, or the
parameter is not an input parameter.public void setShort(int parameterIndex,
short x)
throws SQLException
AS400JDBCPreparedStatementsetShort in interface PreparedStatementsetShort in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value.SQLException - If the statement is not open, the index is not valid or the
parameter is not an input parameter.public void setInt(int parameterIndex,
int x)
throws SQLException
AS400JDBCPreparedStatementsetInt in interface PreparedStatementsetInt in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value.SQLException - If the statement is not open, the index is not valid or the
parameter is not an input parameter.public void setLong(int parameterIndex,
long x)
throws SQLException
AS400JDBCPreparedStatementsetLong in interface PreparedStatementsetLong in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value.SQLException - If the statement is not open, the index is not valid, or the
parameter is not an input parameter.public void setFloat(int parameterIndex,
float x)
throws SQLException
AS400JDBCPreparedStatementsetFloat in interface PreparedStatementsetFloat in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value.SQLException - If the statement is not open, the index is not valid, or the
parameter is not an input parameter.public void setDouble(int parameterIndex,
double x)
throws SQLException
AS400JDBCPreparedStatementsetDouble in interface PreparedStatementsetDouble in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value.SQLException - If the statement is not open, the index is not valid or the
parameter is not an input parameter.public void setBigDecimal(int parameterIndex,
BigDecimal x)
throws SQLException
AS400JDBCPreparedStatementsetBigDecimal in interface PreparedStatementsetBigDecimal in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.SQLException - If the statement is not open, the index is not valid, or the
parameter is not an input parameter.public void setString(int parameterIndex,
String x)
throws SQLException
AS400JDBCPreparedStatementsetString in interface PreparedStatementsetString in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.SQLException - If the statement is not open, the index is not valid, or the
parameter is not an input parameter.public void setBytes(int parameterIndex,
byte[] x)
throws SQLException
AS400JDBCPreparedStatementsetBytes in interface PreparedStatementsetBytes in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.SQLException - If the statement is not open, the index is not valid, or the
parameter is not an input parameter.public void setDate(int parameterIndex,
Date x)
throws SQLException
AS400JDBCPreparedStatementsetDate in interface PreparedStatementsetDate in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.SQLException - If the statement is not open, the index is not valid, or the
parameter is not an input parameter.public void setTime(int parameterIndex,
Time x)
throws SQLException
AS400JDBCPreparedStatementsetTime in interface PreparedStatementsetTime in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.SQLException - If the statement is not open, the index is not valid, or the
parameter is not an input parameter.public void setTimestamp(int parameterIndex,
Timestamp x)
throws SQLException
AS400JDBCPreparedStatementsetTimestamp in interface PreparedStatementsetTimestamp in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.SQLException - If the statement is not open, the index is not valid, or the
parameter is not an input parameter.public void setAsciiStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
AS400JDBCPreparedStatementsetAsciiStream in interface PreparedStatementsetAsciiStream in class AS400JDBCPreparedStatementparameterIndex - 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.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.public void setUnicodeStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
AS400JDBCPreparedStatementNote 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.
setUnicodeStream in interface PreparedStatementsetUnicodeStream in class AS400JDBCPreparedStatementparameterIndex - 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.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 streamAS400JDBCPreparedStatement.setCharacterStream(int, java.io.Reader, int)public void setBinaryStream(int parameterIndex,
InputStream stream,
int length)
throws SQLException
AS400JDBCPreparedStatementsetBinaryStream in interface PreparedStatementsetBinaryStream in class AS400JDBCPreparedStatementparameterIndex - 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.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.public void clearParameters()
throws SQLException
AS400JDBCPreparedStatementclearParameters in interface PreparedStatementclearParameters in class AS400JDBCPreparedStatementSQLException - If the statement is not open.public void setObject(int parameterIndex,
Object x,
int targetSqlType,
int scale)
throws SQLException
AS400JDBCPreparedStatementsetObject in interface PreparedStatementsetObject in class AS400JDBCPreparedStatementparameterIndex - 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.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).public void setObject(int parameterIndex,
Object x,
int targetSqlType)
throws SQLException
AS400JDBCPreparedStatementsetObject in interface PreparedStatementsetObject in class AS400JDBCPreparedStatementparameterIndex - 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.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).public void setObject(int parameterIndex,
Object x)
throws SQLException
AS400JDBCPreparedStatementsetObject in interface PreparedStatementsetObject in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.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).public boolean execute()
throws SQLException
AS400JDBCPreparedStatementUnder 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.
execute in interface PreparedStatementexecute in class AS400JDBCPreparedStatementSQLException - If the statement is not open, the query timeout limit is
exceeded, or an error occurs.public void addBatch()
throws SQLException
AS400JDBCPreparedStatementaddBatch in interface PreparedStatementaddBatch in class AS400JDBCPreparedStatementSQLException - If the statement is not open or an input parameter has not
been set.public void setCharacterStream(int parameterIndex,
Reader reader,
int length)
throws SQLException
AS400JDBCPreparedStatementsetCharacterStream in interface PreparedStatementsetCharacterStream in class AS400JDBCPreparedStatementparameterIndex - 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.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 streampublic void setRef(int parameterIndex,
Ref x)
throws SQLException
AS400JDBCPreparedStatementsetRef in interface PreparedStatementsetRef in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value.SQLException - Always thrown because DB2 for IBM i does not support structured types.public void setBlob(int parameterIndex,
Blob x)
throws SQLException
AS400JDBCPreparedStatementsetBlob in interface PreparedStatementsetBlob in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.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).public void setClob(int parameterIndex,
Clob x)
throws SQLException
AS400JDBCPreparedStatementsetClob in interface PreparedStatementsetClob in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.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).public void setArray(int parameterIndex,
Array x)
throws SQLException
AS400JDBCPreparedStatementsetArray in interface PreparedStatementsetArray in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value.SQLException - Always thrown because DB2 for IBM i does not support arrays.public ResultSetMetaData getMetaData() throws SQLException
AS400JDBCPreparedStatement
PreparedStatement ps = connection
.prepareStatement("INSERT INTO COLLECTION.TABLE VALUES(?)");
ResultSetMetaData rsmd = ps.getMetaData();
getMetaData in interface PreparedStatementgetMetaData in class AS400JDBCPreparedStatementSQLException - If the statement is not open.public void setDate(int parameterIndex,
Date x,
Calendar cal)
throws SQLException
AS400JDBCPreparedStatementsetDate in interface PreparedStatementsetDate in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.cal - The calendar.SQLException - If the statement is not open, the index is not valid, the
parameter is not an input parameter, or the calendar is null.public void setTime(int parameterIndex,
Time x,
Calendar cal)
throws SQLException
AS400JDBCPreparedStatementsetTime in interface PreparedStatementsetTime in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.cal - The calendar.SQLException - If the statement is not open, the index is not valid, the
parameter is not an input parameter, or the calendar is null.public void setTimestamp(int parameterIndex,
Timestamp x,
Calendar cal)
throws SQLException
AS400JDBCPreparedStatementsetTimestamp in interface PreparedStatementsetTimestamp in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.cal - The calendar.SQLException - If the statement is not open, the index is not valid, the
parameter is not an input parameter, or the calendar is null.public void setNull(int parameterIndex,
int sqlType,
String typeName)
throws SQLException
AS400JDBCPreparedStatementsetNull in interface PreparedStatementsetNull in class AS400JDBCPreparedStatementparameterIndex - 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.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.public void setURL(int parameterIndex,
URL x)
throws SQLException
AS400JDBCPreparedStatementsetURL in interface PreparedStatementsetURL in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - The parameter value or null to set the value to SQL NULL.SQLException - If the statement is not open, the index is not valid, or the
parameter is not an input parameter.public ParameterMetaData getParameterMetaData() throws SQLException
AS400JDBCPreparedStatementgetParameterMetaData in interface PreparedStatementgetParameterMetaData in class AS400JDBCPreparedStatementSQLException - If the statement is not open.public void setNClob(int parameterIndex,
Reader reader)
throws SQLException
AS400JDBCPreparedStatementReader object. This method
differs from the setCharacterStream (int, Reader) method
because it informs the driver that the parameter value should be sent to
the server as a NCLOB. When the
setCharacterStream method is used, the driver may have to do
extra work to determine whether the parameter data should be sent to the
server as a LONGNVARCHAR or a NCLOB
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.
setNClob in interface PreparedStatementsetNClob in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).reader - An object that contains the data to set the parameter value to.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 closed PreparedStatementpublic void setAsciiStream(int parameterIndex,
InputStream stream)
throws SQLException
AS400JDBCPreparedStatementLONGVARCHAR parameter, it may be
more practical to send it via a java.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.
setAsciiStream in interface PreparedStatementsetAsciiStream in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).stream - the Java input stream that contains the ASCII parameter valueSQLException - 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 PreparedStatementpublic void setAsciiStream(int parameterIndex,
InputStream stream,
long length)
throws SQLException
AS400JDBCPreparedStatementLONGVARCHAR parameter, it may be more practical to send it via
a java.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.
setAsciiStream in interface PreparedStatementsetAsciiStream in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).stream - the Java input stream that contains the ASCII parameter valuelength - the number of bytes in the streamSQLException - if a database access error occurs or this method is called on
a closed PreparedStatementpublic void setBinaryStream(int parameterIndex,
InputStream stream)
throws SQLException
AS400JDBCPreparedStatementLONGVARBINARY parameter, it may be
more practical to send it via a java.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.
setBinaryStream in interface PreparedStatementsetBinaryStream in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).stream - the java input stream which contains the binary parameter valueSQLException - 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 PreparedStatementpublic void setBinaryStream(int parameterIndex,
InputStream stream,
long length)
throws SQLException
AS400JDBCPreparedStatementLONGVARBINARY parameter, it may be more practical to send it
via a java.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.
setBinaryStream in interface PreparedStatementsetBinaryStream in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).stream - the java input stream which contains the binary parameter valuelength - the number of bytes in the streamSQLException - if a database access error occurs or this method is called on
a closed PreparedStatementpublic void setBlob(int parameterIndex,
InputStream stream)
throws SQLException
AS400JDBCPreparedStatementInputStream object. This
method differs from the setBinaryStream (int, InputStream)
method because it informs the driver that the parameter value should be
sent to the server as a BLOB. When the
setBinaryStream method is used, the driver may have to do
extra work to determine whether the parameter data should be sent to the
server as a LONGVARBINARY or a BLOBsetBlob in interface PreparedStatementsetBlob in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).stream - An object that contains the data to set the parameter value to.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 closed PreparedStatement or if
parameterIndex does not correspond to a parameter marker in the
SQL statement,public void setBlob(int parameterIndex,
InputStream stream,
long length)
throws SQLException
AS400JDBCPreparedStatementInputStream object. The
inputStream must contain the number of characters specified by length
otherwise a SQLException will be generated when the
PreparedStatement is executed.setBlob in interface PreparedStatementsetBlob in class AS400JDBCPreparedStatementparameterIndex - 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.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.public void setCharacterStream(int parameterIndex,
Reader reader)
throws SQLException
AS400JDBCPreparedStatementReader object. When
a very large UNICODE value is input to a LONGVARCHAR
parameter, it may be more practical to send it via a
java.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.
setCharacterStream in interface PreparedStatementsetCharacterStream in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).reader - the java.io.Reader object that contains the Unicode
dataSQLException - 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 PreparedStatementpublic void setCharacterStream(int parameterIndex,
Reader reader,
long length)
throws SQLException
AS400JDBCPreparedStatementReader object,
which is the given number of characters long. When a very large UNICODE
value is input to a LONGVARCHAR parameter, it may be more
practical to send it via a java.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.
setCharacterStream in interface PreparedStatementsetCharacterStream in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).reader - the java.io.Reader object that contains the Unicode
datalength - the number of characters in the streamSQLException - if a database access error occurs or this method is called on
a closed PreparedStatementpublic void setClob(int parameterIndex,
Reader reader)
throws SQLException
AS400JDBCPreparedStatementReader object. This method
differs from the setCharacterStream (int, Reader) method
because it informs the driver that the parameter value should be sent to
the server as a CLOB. When the setCharacterStream
method is used, the driver may have to do extra work to determine whether
the parameter data should be sent to the server as a
LONGVARCHAR or a CLOB
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.
setClob in interface PreparedStatementsetClob in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).reader - An object that contains the data to set the parameter value to.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 closed PreparedStatementor if
parameterIndex does not correspond to a parameter marker in the
SQL statementpublic void setClob(int parameterIndex,
Reader reader,
long length)
throws SQLException
AS400JDBCPreparedStatementReader object. The reader
must contain the number of characters specified by length otherwise a
SQLException will be generated when the
PreparedStatement is executed.setClob in interface PreparedStatementsetClob in class AS400JDBCPreparedStatementparameterIndex - 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.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.public void setNCharacterStream(int parameterIndex,
Reader reader)
throws SQLException
AS400JDBCPreparedStatementReader object. The
Reader 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.
setNCharacterStream in interface PreparedStatementsetNCharacterStream in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).reader - the parameter valueSQLException - 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 closed PreparedStatementpublic void setNCharacterStream(int parameterIndex,
Reader reader,
long length)
throws SQLException
AS400JDBCPreparedStatementReader object. The
Reader 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.setNCharacterStream in interface PreparedStatementsetNCharacterStream in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).reader - the parameter valuelength - the number of characters in the parameter data.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 occurspublic void setNClob(int parameterIndex,
Reader reader,
long length)
throws SQLException
AS400JDBCPreparedStatementReader object. The reader
must contain the number of characters specified by length otherwise a
SQLException will be generated when the
PreparedStatement is executed.setNClob in interface PreparedStatementsetNClob in class AS400JDBCPreparedStatementparameterIndex - 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.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 occurspublic void setNString(int parameterIndex,
String x)
throws SQLException
AS400JDBCPreparedStatementString object. The
driver converts this to a SQL NCHAR or NVARCHAR
or LONGNVARCHAR value (depending on the argument's size
relative to the driver's limits on NVARCHAR values) when it
sends it to the database.setNString in interface PreparedStatementsetNString in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - the parameter valueSQLException - 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 occurspublic void setDB2Default(int parameterIndex)
throws SQLException
AS400JDBCPreparedStatementsetDB2Default in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).SQLException - If the statement is not open, the index is not valid, the
parameter is not an input parameter.public void setDBDefault(int parameterIndex)
throws SQLException
AS400JDBCPreparedStatementsetDBDefault in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).SQLException - If the statement is not open, the index is not valid, the
parameter is not an input parameter.public void setDB2Unassigned(int parameterIndex)
throws SQLException
AS400JDBCPreparedStatementsetDB2Unassigned in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).SQLException - If the statement is not open, the index is not valid, the
parameter is not an input parameter.public void setDBUnassigned(int parameterIndex)
throws SQLException
AS400JDBCPreparedStatementsetDBUnassigned in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).SQLException - If the statement is not open, the index is not valid, the
parameter is not an input parameter.public String getDB2ParameterName(int parm) throws SQLException
AS400JDBCPreparedStatementgetDB2ParameterName in class AS400JDBCPreparedStatementparm - the parameter number to get the name forSQLException - If a database error occurs.public void setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
int scaleOrLength)
throws SQLException
AS400JDBCPreparedStatementThe 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.
setObject in interface PreparedStatementsetObject in class AS400JDBCPreparedStatementparameterIndex - - 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.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 zeropublic void setObject(int parameterIndex,
Object x,
SQLType targetSqlType)
throws SQLException
AS400JDBCPreparedStatementsetObject in interface PreparedStatementsetObject in class AS400JDBCPreparedStatementparameterIndex - - 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 parameterIndexSQLException - - 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 PreparedStatementpublic long executeLargeUpdate()
throws SQLException
AS400JDBCPreparedStatementThis method should be used when the returned row count may exceed Integer.MAX_VALUE.
executeLargeUpdate in interface PreparedStatementexecuteLargeUpdate in class AS400JDBCPreparedStatementSQLException - - if a database access error occurs; this method is called on a
closed PreparedStatement or the SQL statement returns a ResultSet objectpublic void setNClob(int parameterIndex,
NClob clob)
throws SQLException
AS400JDBCPreparedStatementjava.sql.NClob object. The driver converts this to a
SQL NCLOB value when it sends it to the database.setNClob in interface PreparedStatementsetNClob in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).clob - the parameter valueSQLException - 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 occurspublic void setSQLXML(int parameterIndex,
SQLXML xml)
throws SQLException
AS400JDBCPreparedStatementjava.sql.SQLXML object.setSQLXML in interface PreparedStatementsetSQLXML in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).xml - a SQLXML object that maps an SQL XML valueSQLException - if a database access error occurspublic void setRowId(int parameterIndex,
RowId x)
throws SQLException
AS400JDBCPreparedStatementjava.sql.RowId object. The
driver converts this to a SQL ROWID value when it sends it
to the databasesetRowId in interface PreparedStatementsetRowId in class AS400JDBCPreparedStatementparameterIndex - The parameter index (1-based).x - the parameter valueSQLException - if a database access error occurspublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor on the wrapped object. If this does not
implement the interface and is not a wrapper, return false. This method
should be implemented as a low-cost operation compared to
unwrap so that callers can use this method to avoid
expensive unwrap calls that may fail. If this method
returns true then calling unwrap with the same argument
should succeed.isWrapperFor in interface Wrapperiface - a Class defining an interface.SQLException - If a database error occurs.
if an error occurs while determining whether this is a
wrapper for an object with the given interface.public <T> T unwrap(Class<T> iface) throws SQLException
unwrap recursively on the wrapped object or a
proxy for that result. If the receiver is not a wrapper and does not
implement the interface, then an SQLException is thrown.unwrap in interface Wrapperiface - A Class defining an interface that the result must implement.SQLException - If a database error occurs.
If no object found that implements the interfaceCopyright © 2024. All rights reserved.