Package org.h2.jdbc

# Class JdbcPreparedStatement

java.lang.Object
org.h2.message.TraceObject
org.h2.jdbc.JdbcStatement
org.h2.jdbc.JdbcPreparedStatement

All Implemented Interfaces:
  `AutoCloseable`, `PreparedStatement`, `Statement`, `Wrapper`

Direct Known Subclasses:
  `JdbcCallableStatement`

public class JdbcPreparedStatement extends JdbcStatement implements PreparedStatement
Represents a prepared statement.

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
Modifier and Type
Field
Description
`protected CommandInterface`
`command`

### 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 Type
Method
Description
`void`
`addBatch()`
Adds the current settings to the batch.
`void`
`addBatch(String sql)`
Calling this method is not legal on a PreparedStatement.
`void`
`clearBatch()`
Clears the batch.
`void`
`clearParameters()`
Clears all parameters.
`void`
`close()`
Closes this statement.
`boolean`
`execute()`
Executes an arbitrary statement.
`int[]`
`executeBatch()`
Executes the batch.
`long[]`
`executeLargeBatch()`
Executes the batch.
`long`
`executeLargeUpdate()`
Executes a statement (insert, update, delete, create, drop) and returns the update count.
`ResultSet`
`executeQuery()`
Executes a query (select statement) and returns the result set.
`ResultSet`
`executeQuery(String sql)`
Calling this method is not legal on a PreparedStatement.
`int`
`executeUpdate()`
Executes a statement (insert, update, delete, create, drop) and returns the update count.
`ResultSetMetaData`
`getMetaData()`
Gets the result set metadata of the query returned when the statement is executed.
`ParameterMetaData`
`getParameterMetaData()`
Get the parameter meta data of this prepared statement.
`void`
`setArray(int parameterIndex, Array x)`
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`
`setBlob(int parameterIndex, Blob x)`
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`
`setClob(int parameterIndex, Reader x)`
Sets the value of a parameter as a Clob.
`void`
`setClob(int parameterIndex, Reader x, long length)`
Sets the value of a parameter as a Clob.
`void`
`setClob(int parameterIndex, Clob x)`
Sets the value of a parameter as a Clob.
`void`
`setDate(int parameterIndex, Date x)`
Sets the value of a parameter.
`void`
`setDate(int parameterIndex, Date x, Calendar calendar)`
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`
`setNClob(int parameterIndex, Reader x)`
Sets the value of a parameter as a Clob.
`void`
`setNClob(int parameterIndex, Reader x, long length)`
Sets the value of a parameter as a Clob.
`void`
`setNClob(int parameterIndex, NClob x)`
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`
`setNull(int parameterIndex, int sqlType, String typeName)`
Sets a parameter to null.
`void`
`setObject(int parameterIndex, Object x)`
Sets the value of a parameter.
`void`
`setObject(int parameterIndex, Object x, int targetSqlType)`
Sets the value of a parameter.
`void`
`setObject(int parameterIndex, Object x, int targetSqlType, int scale)`
Sets the value of a parameter.
`void`
`setObject(int parameterIndex, Object x, SQLType targetSqlType)`
Sets the value of a parameter.
`void`
`setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength)`
Sets the value of a parameter.
`void`
`setRef(int parameterIndex, Ref x)`
[Not supported] Sets the value of a column as a reference.
`void`
`setRowId(int parameterIndex, RowId x)`
[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`
`setSQLXML(int parameterIndex, SQLXML x)`
Sets the value of a parameter as a SQLXML.
`void`
`setString(int parameterIndex, String x)`
Sets the value of a parameter.
`void`
`setTime(int parameterIndex, Time x)`
Sets the value of a parameter.
`void`
`setTime(int parameterIndex, Time x, Calendar calendar)`
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 setCharacterStream
`void`
`setURL(int parameterIndex, URL x)`
[Not supported]
`String`
`toString()`
INTERNAL

### Methods 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 CommandInterface command

## Method Details

### executeQuery

public ResultSet executeQuery() throws SQLException
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 interface `PreparedStatement`
Returns:
  the result set
Throws:
  `SQLException` - if this object is closed or invalid

### executeUpdate

public int executeUpdate() throws SQLException
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 interface `PreparedStatement`
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 for `int` data type)
Throws:
  `SQLException` - if this object is closed or invalid
See Also:
  - `executeLargeUpdate()`

### executeLargeUpdate

public long executeLargeUpdate() throws SQLException
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 interface `PreparedStatement`
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

public boolean execute() throws SQLException
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 interface `PreparedStatement`
Returns:
  true if a result set is available, false if not
Throws:
  `SQLException` - if this object is closed or invalid

### clearParameters

public void clearParameters() throws SQLException
Clears all parameters.

Specified by:
  `clearParameters` in interface `PreparedStatement`
Throws:
  `SQLException` - if this object is closed or invalid

### executeQuery

public ResultSet executeQuery(String sql) throws SQLException
Calling this method is not legal on a PreparedStatement.

Specified by:
  `executeQuery` in interface `Statement`
Overrides:
  `executeQuery` in class `JdbcStatement`
Parameters:
  `sql` - ignored
Returns:
  the result set
Throws:
  `SQLException` - Unsupported Feature

### addBatch

public void addBatch(String sql) throws SQLException
Calling this method is not legal on a PreparedStatement.

Specified by:
  `addBatch` in interface `Statement`
Overrides:
  `addBatch` in class `JdbcStatement`
Parameters:
  `sql` - ignored
Throws:
  `SQLException` - Unsupported Feature

### setNull

public void setNull(int parameterIndex, int sqlType) throws SQLException
Sets a parameter to null.

Specified by:
  `setNull` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `sqlType` - the data type (Types.x)
Throws:
  `SQLException` - if this object is closed

### setInt

public void setInt(int parameterIndex, int x) throws SQLException
Sets the value of a parameter.

Specified by:
  `setInt` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setString

public void setString(int parameterIndex, String x) throws SQLException
Sets the value of a parameter.

Specified by:
  `setString` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setBigDecimal

public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
Sets the value of a parameter.

Specified by:
  `setBigDecimal` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setDate

public void setDate(int parameterIndex, Date x) throws SQLException
Sets the value of a parameter.

Usage of this method is discouraged. Use `setObject(parameterIndex, value)` with `LocalDate` parameter instead.

Specified by:
  `setDate` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed
See Also:
  - `setObject(int, Object)`

### setTime

public void setTime(int parameterIndex, Time x) throws SQLException
Sets the value of a parameter.

Usage of this method is discouraged. Use `setObject(parameterIndex, value)` with `LocalTime` parameter instead.

Specified by:
  `setTime` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed
See Also:
  - `setObject(int, Object)`

### setTimestamp

public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
Sets the value of a parameter.

Usage of this method is discouraged. Use `setObject(parameterIndex, value)` with `LocalDateTime` parameter instead.

Specified by:
  `setTimestamp` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed
See Also:
  - `setObject(int, Object)`

### setObject

public void setObject(int parameterIndex, Object x) throws SQLException
Sets the value of a parameter. Objects of unknown classes are serialized (on the client side).

Specified by:
  `setObject` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setObject

public void setObject(int parameterIndex, Object x, int targetSqlType) 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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value, null is allowed
  `targetSqlType` - 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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value, null is allowed
  `targetSqlType` - the type as defined in java.sql.Types
  `scale` - is ignored
Throws:
  `SQLException` - if this object is closed

### setObject

public void setObject(int parameterIndex, Object x, SQLType targetSqlType) 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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value, null is allowed
  `targetSqlType` - 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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value, null is allowed
  `targetSqlType` - the SQL type
  `scaleOrLength` - is ignored
Throws:
  `SQLException` - if this object is closed

### setBoolean

public void setBoolean(int parameterIndex, boolean x) throws SQLException
Sets the value of a parameter.

Specified by:
  `setBoolean` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setByte

public void setByte(int parameterIndex, byte x) throws SQLException
Sets the value of a parameter.

Specified by:
  `setByte` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setShort

public void setShort(int parameterIndex, short x) throws SQLException
Sets the value of a parameter.

Specified by:
  `setShort` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setLong

public void setLong(int parameterIndex, long x) throws SQLException
Sets the value of a parameter.

Specified by:
  `setLong` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setFloat

public void setFloat(int parameterIndex, float x) throws SQLException
Sets the value of a parameter.

Specified by:
  `setFloat` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setDouble

public void setDouble(int parameterIndex, double x) throws SQLException
Sets the value of a parameter.

Specified by:
  `setDouble` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setRef

public void setRef(int parameterIndex, Ref x) throws SQLException
[Not supported] Sets the value of a column as a reference.

Specified by:
  `setRef` in interface `PreparedStatement`
Throws:
  `SQLException`

### setDate

public void setDate(int parameterIndex, Date x, Calendar calendar) throws SQLException
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)` with `LocalDate` parameter instead.

Specified by:
  `setDate` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `calendar` - the calendar
Throws:
  `SQLException` - if this object is closed
See Also:
  - `setObject(int, Object)`

### setTime

public void setTime(int parameterIndex, Time x, Calendar calendar) throws SQLException
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)` with `LocalTime` parameter instead.

Specified by:
  `setTime` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `calendar` - the calendar
Throws:
  `SQLException` - if this object is closed
See Also:
  - `setObject(int, Object)`

### setTimestamp

public void setTimestamp(int parameterIndex, Timestamp x, Calendar calendar) throws SQLException
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)` with `LocalDateTime` parameter instead.

Specified by:
  `setTimestamp` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `calendar` - the calendar
Throws:
  `SQLException` - if this object is closed
See Also:
  - `setObject(int, Object)`

### 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 interface `PreparedStatement`
Throws:
  `SQLException`

### setNull

public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException
Sets a parameter to null.

Specified by:
  `setNull` in interface `PreparedStatement`
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

public void setBlob(int parameterIndex, Blob x) throws SQLException
Sets the value of a parameter as a Blob.

Specified by:
  `setBlob` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setBlob

public void setBlob(int parameterIndex, InputStream x) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setClob

public void setClob(int parameterIndex, Clob x) throws SQLException
Sets the value of a parameter as a Clob.

Specified by:
  `setClob` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setClob

public void setClob(int parameterIndex, Reader x) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setArray

public void setArray(int parameterIndex, Array x) throws SQLException
Sets the value of a parameter as an Array.

Specified by:
  `setArray` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setBytes

public void setBytes(int parameterIndex, byte[] x) throws SQLException
Sets the value of a parameter as a byte array.

Specified by:
  `setBytes` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setBinaryStream

public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `length` - the maximum number of bytes
Throws:
  `SQLException` - if this object is closed

### setBinaryStream

public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `length` - the maximum number of bytes
Throws:
  `SQLException` - if this object is closed

### setBinaryStream

public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setAsciiStream

public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `length` - the maximum number of bytes
Throws:
  `SQLException` - if this object is closed

### setAsciiStream

public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `length` - the maximum number of bytes
Throws:
  `SQLException` - if this object is closed

### setAsciiStream

public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setCharacterStream

public void setCharacterStream(int parameterIndex, Reader x, int length) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `length` - the maximum number of characters
Throws:
  `SQLException` - if this object is closed

### setCharacterStream

public void setCharacterStream(int parameterIndex, Reader x) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setCharacterStream

public void setCharacterStream(int parameterIndex, Reader x, long length) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `length` - the maximum number of characters
Throws:
  `SQLException` - if this object is closed

### setURL

public void setURL(int parameterIndex, URL x) throws SQLException
[Not supported]

Specified by:
  `setURL` in interface `PreparedStatement`
Throws:
  `SQLException`

### getMetaData

public ResultSetMetaData getMetaData() throws SQLException
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 interface `PreparedStatement`
Returns:
  the meta data or null if this is not a query
Throws:
  `SQLException` - if this object is closed

### clearBatch

public void clearBatch() throws SQLException
Clears the batch.

Specified by:
  `clearBatch` in interface `Statement`
Overrides:
  `clearBatch` in class `JdbcStatement`
Throws:
  `SQLException`

### close

public void close() throws SQLException
Closes this statement. All result sets that where created by this statement become invalid after calling this method.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Statement`
Overrides:
  `close` in class `JdbcStatement`
Throws:
  `SQLException`

### executeBatch

public int[] executeBatch() throws SQLException
Executes the batch. If one of the batched statements fails, this database will continue.

Specified by:
  `executeBatch` in interface `Statement`
Overrides:
  `executeBatch` in class `JdbcStatement`
Returns:
  the array of update counts
Throws:
  `SQLException`
See Also:
  - `executeLargeBatch()`

### executeLargeBatch

public long[] executeLargeBatch() throws SQLException
Executes the batch. If one of the batched statements fails, this database will continue.

Specified by:
  `executeLargeBatch` in interface `Statement`
Overrides:
  `executeLargeBatch` in class `JdbcStatement`
Returns:
  the array of update counts
Throws:
  `SQLException`

### addBatch

public void addBatch() throws SQLException
Adds the current settings to the batch.

Specified by:
  `addBatch` in interface `PreparedStatement`
Throws:
  `SQLException`

### getParameterMetaData

public ParameterMetaData getParameterMetaData() throws SQLException
Get the parameter meta data of this prepared statement.

Specified by:
  `getParameterMetaData` in interface `PreparedStatement`
Returns:
  the meta data
Throws:
  `SQLException`

### setRowId

public void setRowId(int parameterIndex, RowId x) throws SQLException
[Not supported] Sets the value of a parameter as a row id.

Specified by:
  `setRowId` in interface `PreparedStatement`
Throws:
  `SQLException`

### setNString

public void setNString(int parameterIndex, String x) throws SQLException
Sets the value of a parameter.

Specified by:
  `setNString` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setNCharacterStream

public void setNCharacterStream(int parameterIndex, Reader x, long length) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `length` - the maximum number of characters
Throws:
  `SQLException` - if this object is closed

### setNCharacterStream

public void setNCharacterStream(int parameterIndex, Reader x) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setNClob

public void setNClob(int parameterIndex, NClob x) throws SQLException
Sets the value of a parameter as a Clob.

Specified by:
  `setNClob` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setNClob

public void setNClob(int parameterIndex, Reader x) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### setClob

public void setClob(int parameterIndex, Reader x, long length) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `length` - the maximum number of characters
Throws:
  `SQLException` - if this object is closed

### setBlob

public void setBlob(int parameterIndex, InputStream x, long length) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `length` - the maximum number of bytes
Throws:
  `SQLException` - if this object is closed

### setNClob

public void setNClob(int parameterIndex, Reader x, long length) throws SQLException
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 interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
  `length` - the maximum number of characters
Throws:
  `SQLException` - if this object is closed

### setSQLXML

public void setSQLXML(int parameterIndex, SQLXML x) throws SQLException
Sets the value of a parameter as a SQLXML.

Specified by:
  `setSQLXML` in interface `PreparedStatement`
Parameters:
  `parameterIndex` - the parameter index (1, 2, ...)
  `x` - the value
Throws:
  `SQLException` - if this object is closed

### toString

public String toString()
INTERNAL

Overrides:
  `toString` in class `JdbcStatement`