Class JdbcPreparedStatement
- All Implemented Interfaces:
AutoCloseable
,PreparedStatement
,Statement
,Wrapper
- Direct Known Subclasses:
JdbcCallableStatement
Thread safety: the prepared statement is not thread-safe. If the same prepared statement is used by multiple threads access to it must be synchronized. The single synchronized block must include assignment of parameters, execution of the command and all operations with its result.
synchronized (prep) { prep.setInt(1, 10); try (ResultSet rs = prep.executeQuery()) { while (rs.next) { // Do something } } } synchronized (prep) { prep.setInt(1, 15); updateCount = prep.executeUpdate(); }
-
Field Summary
Fields inherited from class org.h2.jdbc.JdbcStatement
conn, fetchSize, generatedKeys, maxRows, resultSet, resultSetConcurrency, resultSetType, session, updateCount
Fields inherited from class org.h2.message.TraceObject
ARRAY, BLOB, CALLABLE_STATEMENT, CLOB, CONNECTION, DATA_SOURCE, DATABASE_META_DATA, PARAMETER_META_DATA, PREPARED_STATEMENT, RESULT_SET, RESULT_SET_META_DATA, SAVEPOINT, SQLXML, STATEMENT, trace, XA_DATA_SOURCE, XID
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBatch()
Adds the current settings to the batch.void
Calling this method is not legal on a PreparedStatement.void
Clears the batch.void
Clears all parameters.void
close()
Closes this statement.boolean
execute()
Executes an arbitrary statement.int[]
Executes the batch.long[]
Executes the batch.long
Executes a statement (insert, update, delete, create, drop) and returns the update count.Executes a query (select statement) and returns the result set.executeQuery
(String sql) Calling this method is not legal on a PreparedStatement.int
Executes a statement (insert, update, delete, create, drop) and returns the update count.Gets the result set metadata of the query returned when the statement is executed.Get the parameter meta data of this prepared statement.void
Sets the value of a parameter as an Array.void
setAsciiStream
(int parameterIndex, InputStream x) Sets the value of a parameter as an ASCII stream.void
setAsciiStream
(int parameterIndex, InputStream x, int length) Sets the value of a parameter as an ASCII stream.void
setAsciiStream
(int parameterIndex, InputStream x, long length) Sets the value of a parameter as an ASCII stream.void
setBigDecimal
(int parameterIndex, BigDecimal x) Sets the value of a parameter.void
setBinaryStream
(int parameterIndex, InputStream x) Sets the value of a parameter as an input stream.void
setBinaryStream
(int parameterIndex, InputStream x, int length) Sets the value of a parameter as an input stream.void
setBinaryStream
(int parameterIndex, InputStream x, long length) Sets the value of a parameter as an input stream.void
setBlob
(int parameterIndex, InputStream x) Sets the value of a parameter as a Blob.void
setBlob
(int parameterIndex, InputStream x, long length) Sets the value of a parameter as a Blob.void
Sets the value of a parameter as a Blob.void
setBoolean
(int parameterIndex, boolean x) Sets the value of a parameter.void
setByte
(int parameterIndex, byte x) Sets the value of a parameter.void
setBytes
(int parameterIndex, byte[] x) Sets the value of a parameter as a byte array.void
setCharacterStream
(int parameterIndex, Reader x) Sets the value of a parameter as a character stream.void
setCharacterStream
(int parameterIndex, Reader x, int length) Sets the value of a parameter as a character stream.void
setCharacterStream
(int parameterIndex, Reader x, long length) Sets the value of a parameter as a character stream.void
Sets the value of a parameter as a Clob.void
Sets the value of a parameter as a Clob.void
Sets the value of a parameter as a Clob.void
Sets the value of a parameter.void
Sets the date using a specified time zone.void
setDouble
(int parameterIndex, double x) Sets the value of a parameter.void
setFloat
(int parameterIndex, float x) Sets the value of a parameter.void
setInt
(int parameterIndex, int x) Sets the value of a parameter.void
setLong
(int parameterIndex, long x) Sets the value of a parameter.void
setNCharacterStream
(int parameterIndex, Reader x) Sets the value of a parameter as a character stream.void
setNCharacterStream
(int parameterIndex, Reader x, long length) Sets the value of a parameter as a character stream.void
Sets the value of a parameter as a Clob.void
Sets the value of a parameter as a Clob.void
Sets the value of a parameter as a Clob.void
setNString
(int parameterIndex, String x) Sets the value of a parameter.void
setNull
(int parameterIndex, int sqlType) Sets a parameter to null.void
Sets a parameter to null.void
Sets the value of a parameter.void
Sets the value of a parameter.void
Sets the value of a parameter.void
Sets the value of a parameter.void
Sets the value of a parameter.void
[Not supported] Sets the value of a column as a reference.void
[Not supported] Sets the value of a parameter as a row id.void
setShort
(int parameterIndex, short x) Sets the value of a parameter.void
Sets the value of a parameter as a SQLXML.void
Sets the value of a parameter.void
Sets the value of a parameter.void
Sets the time using a specified time zone.void
setTimestamp
(int parameterIndex, Timestamp x) Sets the value of a parameter.void
setTimestamp
(int parameterIndex, Timestamp x, Calendar calendar) Sets the timestamp using a specified time zone.void
setUnicodeStream
(int parameterIndex, InputStream x, int length) Deprecated.since JDBC 2.0, use setCharacterStreamvoid
[Not supported]toString()
INTERNALMethods inherited from class org.h2.jdbc.JdbcStatement
cancel, clearWarnings, closeOldResultSet, closeOnCompletion, enquoteIdentifier, execute, execute, execute, execute, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isCancelled, isClosed, isCloseOnCompletion, isPoolable, isSimpleIdentifier, isWrapperFor, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, unwrap
Methods inherited from class org.h2.message.TraceObject
debugCode, debugCodeAssign, debugCodeCall, debugCodeCall, debugCodeCall, getNextId, getTraceId, getTraceObjectName, isDebugEnabled, isInfoEnabled, logAndConvert, quote, quoteArray, quoteBigDecimal, quoteBytes, quoteDate, quoteIntArray, quoteMap, quoteTime, quoteTimestamp, setTrace, unsupported
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.sql.Statement
cancel, clearWarnings, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, execute, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Field Details
-
command
protected org.h2.command.CommandInterface command
-
-
Method Details
-
executeQuery
Executes a query (select statement) and returns the result set. If another result set exists for this statement, this will be closed (even if this statement fails).- Specified by:
executeQuery
in interfacePreparedStatement
- Returns:
- the result set
- Throws:
SQLException
- if this object is closed or invalid
-
executeUpdate
Executes a statement (insert, update, delete, create, drop) and returns the update count. If another result set exists for this statement, this will be closed (even if this statement fails). If auto commit is on, this statement will be committed. If the statement is a DDL statement (create, drop, alter) and does not throw an exception, the current transaction (if any) is committed after executing the statement.- Specified by:
executeUpdate
in interfacePreparedStatement
- Returns:
- the update count (number of affected rows by a DML statement or
other statement able to return number of rows, or 0 if no rows
were affected or the statement returns nothing, or
Statement.SUCCESS_NO_INFO
if number of rows is too large forint
data type) - Throws:
SQLException
- if this object is closed or invalid- See Also:
-
executeLargeUpdate
Executes a statement (insert, update, delete, create, drop) and returns the update count. If another result set exists for this statement, this will be closed (even if this statement fails). If auto commit is on, this statement will be committed. If the statement is a DDL statement (create, drop, alter) and does not throw an exception, the current transaction (if any) is committed after executing the statement.- Specified by:
executeLargeUpdate
in interfacePreparedStatement
- Returns:
- the update count (number of affected rows by a DML statement or other statement able to return number of rows, or 0 if no rows were affected or the statement returns nothing)
- Throws:
SQLException
- if this object is closed or invalid
-
execute
Executes an arbitrary statement. If another result set exists for this statement, this will be closed (even if this statement fails). If auto commit is on, and the statement is not a select, this statement will be committed.- Specified by:
execute
in interfacePreparedStatement
- Returns:
- true if a result set is available, false if not
- Throws:
SQLException
- if this object is closed or invalid
-
clearParameters
Clears all parameters.- Specified by:
clearParameters
in interfacePreparedStatement
- Throws:
SQLException
- if this object is closed or invalid
-
executeQuery
Calling this method is not legal on a PreparedStatement.- Specified by:
executeQuery
in interfaceStatement
- Overrides:
executeQuery
in classJdbcStatement
- Parameters:
sql
- ignored- Returns:
- the result set
- Throws:
SQLException
- Unsupported Feature
-
addBatch
Calling this method is not legal on a PreparedStatement.- Specified by:
addBatch
in interfaceStatement
- Overrides:
addBatch
in classJdbcStatement
- Parameters:
sql
- ignored- Throws:
SQLException
- Unsupported Feature
-
setNull
Sets a parameter to null.- Specified by:
setNull
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)sqlType
- the data type (Types.x)- Throws:
SQLException
- if this object is closed
-
setInt
Sets the value of a parameter.- Specified by:
setInt
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setString
Sets the value of a parameter.- Specified by:
setString
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setBigDecimal
Sets the value of a parameter.- Specified by:
setBigDecimal
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setDate
Sets the value of a parameter.Usage of this method is discouraged. Use
setObject(parameterIndex, value)
withLocalDate
parameter instead.- Specified by:
setDate
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed- See Also:
-
setTime
Sets the value of a parameter.Usage of this method is discouraged. Use
setObject(parameterIndex, value)
withLocalTime
parameter instead.- Specified by:
setTime
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed- See Also:
-
setTimestamp
Sets the value of a parameter.Usage of this method is discouraged. Use
setObject(parameterIndex, value)
withLocalDateTime
parameter instead.- Specified by:
setTimestamp
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed- See Also:
-
setObject
Sets the value of a parameter. Objects of unknown classes are serialized (on the client side).- Specified by:
setObject
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setObject
Sets the value of a parameter. The object is converted, if required, to the specified data type before sending to the database. Objects of unknown classes are serialized (on the client side).- Specified by:
setObject
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value, null is allowedtargetSqlType
- the type as defined in java.sql.Types- Throws:
SQLException
- if this object is closed
-
setObject
public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException Sets the value of a parameter. The object is converted, if required, to the specified data type before sending to the database. Objects of unknown classes are serialized (on the client side).- Specified by:
setObject
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value, null is allowedtargetSqlType
- the type as defined in java.sql.Typesscale
- is ignored- Throws:
SQLException
- if this object is closed
-
setObject
Sets the value of a parameter. The object is converted, if required, to the specified data type before sending to the database. Objects of unknown classes are serialized (on the client side).- Specified by:
setObject
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value, null is allowedtargetSqlType
- the SQL type- Throws:
SQLException
- if this object is closed
-
setObject
public void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException Sets the value of a parameter. The object is converted, if required, to the specified data type before sending to the database. Objects of unknown classes are serialized (on the client side).- Specified by:
setObject
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value, null is allowedtargetSqlType
- the SQL typescaleOrLength
- is ignored- Throws:
SQLException
- if this object is closed
-
setBoolean
Sets the value of a parameter.- Specified by:
setBoolean
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setByte
Sets the value of a parameter.- Specified by:
setByte
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setShort
Sets the value of a parameter.- Specified by:
setShort
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setLong
Sets the value of a parameter.- Specified by:
setLong
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setFloat
Sets the value of a parameter.- Specified by:
setFloat
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setDouble
Sets the value of a parameter.- Specified by:
setDouble
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setRef
[Not supported] Sets the value of a column as a reference.- Specified by:
setRef
in interfacePreparedStatement
- Throws:
SQLException
-
setDate
Sets the date using a specified time zone. The value will be converted to the local time zone.Usage of this method is discouraged. Use
setObject(parameterIndex, value)
withLocalDate
parameter instead.- Specified by:
setDate
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuecalendar
- the calendar- Throws:
SQLException
- if this object is closed- See Also:
-
setTime
Sets the time using a specified time zone. The value will be converted to the local time zone.Usage of this method is discouraged. Use
setObject(parameterIndex, value)
withLocalTime
parameter instead.- Specified by:
setTime
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuecalendar
- the calendar- Throws:
SQLException
- if this object is closed- See Also:
-
setTimestamp
Sets the timestamp using a specified time zone. The value will be converted to the local time zone.Usage of this method is discouraged. Use
setObject(parameterIndex, value)
withLocalDateTime
parameter instead.- Specified by:
setTimestamp
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuecalendar
- the calendar- Throws:
SQLException
- if this object is closed- See Also:
-
setUnicodeStream
@Deprecated public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException Deprecated.since JDBC 2.0, use setCharacterStream[Not supported] This feature is deprecated and not supported.- Specified by:
setUnicodeStream
in interfacePreparedStatement
- Throws:
SQLException
-
setNull
Sets a parameter to null.- Specified by:
setNull
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)sqlType
- the data type (Types.x)typeName
- this parameter is ignored- Throws:
SQLException
- if this object is closed
-
setBlob
Sets the value of a parameter as a Blob.- Specified by:
setBlob
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setBlob
Sets the value of a parameter as a Blob. This method does not close the stream. The stream may be closed after executing the statement.- Specified by:
setBlob
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setClob
Sets the value of a parameter as a Clob.- Specified by:
setClob
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setClob
Sets the value of a parameter as a Clob. This method does not close the reader. The reader may be closed after executing the statement.- Specified by:
setClob
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setArray
Sets the value of a parameter as an Array.- Specified by:
setArray
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setBytes
Sets the value of a parameter as a byte array.- Specified by:
setBytes
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setBinaryStream
Sets the value of a parameter as an input stream. This method does not close the stream. The stream may be closed after executing the statement.- Specified by:
setBinaryStream
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of bytes- Throws:
SQLException
- if this object is closed
-
setBinaryStream
Sets the value of a parameter as an input stream. This method does not close the stream. The stream may be closed after executing the statement.- Specified by:
setBinaryStream
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of bytes- Throws:
SQLException
- if this object is closed
-
setBinaryStream
Sets the value of a parameter as an input stream. This method does not close the stream. The stream may be closed after executing the statement.- Specified by:
setBinaryStream
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setAsciiStream
Sets the value of a parameter as an ASCII stream. This method does not close the stream. The stream may be closed after executing the statement.- Specified by:
setAsciiStream
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of bytes- Throws:
SQLException
- if this object is closed
-
setAsciiStream
Sets the value of a parameter as an ASCII stream. This method does not close the stream. The stream may be closed after executing the statement.- Specified by:
setAsciiStream
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of bytes- Throws:
SQLException
- if this object is closed
-
setAsciiStream
Sets the value of a parameter as an ASCII stream. This method does not close the stream. The stream may be closed after executing the statement.- Specified by:
setAsciiStream
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setCharacterStream
Sets the value of a parameter as a character stream. This method does not close the reader. The reader may be closed after executing the statement.- Specified by:
setCharacterStream
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of characters- Throws:
SQLException
- if this object is closed
-
setCharacterStream
Sets the value of a parameter as a character stream. This method does not close the reader. The reader may be closed after executing the statement.- Specified by:
setCharacterStream
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setCharacterStream
Sets the value of a parameter as a character stream. This method does not close the reader. The reader may be closed after executing the statement.- Specified by:
setCharacterStream
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of characters- Throws:
SQLException
- if this object is closed
-
setURL
[Not supported]- Specified by:
setURL
in interfacePreparedStatement
- Throws:
SQLException
-
getMetaData
Gets the result set metadata of the query returned when the statement is executed. If this is not a query, this method returns null.- Specified by:
getMetaData
in interfacePreparedStatement
- Returns:
- the meta data or null if this is not a query
- Throws:
SQLException
- if this object is closed
-
clearBatch
Clears the batch.- Specified by:
clearBatch
in interfaceStatement
- Overrides:
clearBatch
in classJdbcStatement
- Throws:
SQLException
-
close
Closes this statement. All result sets that where created by this statement become invalid after calling this method.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceStatement
- Overrides:
close
in classJdbcStatement
- Throws:
SQLException
-
executeBatch
Executes the batch. If one of the batched statements fails, this database will continue.- Specified by:
executeBatch
in interfaceStatement
- Overrides:
executeBatch
in classJdbcStatement
- Returns:
- the array of update counts
- Throws:
SQLException
- See Also:
-
executeLargeBatch
Executes the batch. If one of the batched statements fails, this database will continue.- Specified by:
executeLargeBatch
in interfaceStatement
- Overrides:
executeLargeBatch
in classJdbcStatement
- Returns:
- the array of update counts
- Throws:
SQLException
-
addBatch
Adds the current settings to the batch.- Specified by:
addBatch
in interfacePreparedStatement
- Throws:
SQLException
-
getParameterMetaData
Get the parameter meta data of this prepared statement.- Specified by:
getParameterMetaData
in interfacePreparedStatement
- Returns:
- the meta data
- Throws:
SQLException
-
setRowId
[Not supported] Sets the value of a parameter as a row id.- Specified by:
setRowId
in interfacePreparedStatement
- Throws:
SQLException
-
setNString
Sets the value of a parameter.- Specified by:
setNString
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setNCharacterStream
Sets the value of a parameter as a character stream. This method does not close the reader. The reader may be closed after executing the statement.- Specified by:
setNCharacterStream
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of characters- Throws:
SQLException
- if this object is closed
-
setNCharacterStream
Sets the value of a parameter as a character stream. This method does not close the reader. The reader may be closed after executing the statement.- Specified by:
setNCharacterStream
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setNClob
Sets the value of a parameter as a Clob.- Specified by:
setNClob
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setNClob
Sets the value of a parameter as a Clob. This method does not close the reader. The reader may be closed after executing the statement.- Specified by:
setNClob
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
setClob
Sets the value of a parameter as a Clob. This method does not close the reader. The reader may be closed after executing the statement.- Specified by:
setClob
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of characters- Throws:
SQLException
- if this object is closed
-
setBlob
Sets the value of a parameter as a Blob. This method does not close the stream. The stream may be closed after executing the statement.- Specified by:
setBlob
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of bytes- Throws:
SQLException
- if this object is closed
-
setNClob
Sets the value of a parameter as a Clob. This method does not close the reader. The reader may be closed after executing the statement.- Specified by:
setNClob
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of characters- Throws:
SQLException
- if this object is closed
-
setSQLXML
Sets the value of a parameter as a SQLXML.- Specified by:
setSQLXML
in interfacePreparedStatement
- Parameters:
parameterIndex
- the parameter index (1, 2, ...)x
- the value- Throws:
SQLException
- if this object is closed
-
toString
INTERNAL- Overrides:
toString
in classJdbcStatement
-