ISQLServerPreparedStatement, ISQLServerStatement, AutoCloseable, PreparedStatement, Statement, WrapperSQLServerCallableStatementpublic class SQLServerPreparedStatement extends SQLServerStatement implements ISQLServerPreparedStatement
SQLServerPreparedStatement prepares a statement using SQL Server's sp_prepexec and re-uses the returned statement handle for each subsequent execution of the statement (typically using different parameters provided by the user)
SQLServerPreparedStatement supports batching whereby a set of prepared statements are executed in a single database round trip to improve runtime performance.
The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API interfaces javadoc for those details.
stmtColumnEncriptionSettingCLOSE_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() |
|
void |
addBatch(String sql) |
|
void |
clearBatch() |
|
void |
clearParameters() |
|
boolean |
execute() |
|
boolean |
execute(String sql) |
|
int[] |
executeBatch() |
Sends a batch of statements to the database.
|
long[] |
executeLargeBatch() |
|
long |
executeLargeUpdate() |
|
ResultSet |
executeQuery() |
|
ResultSet |
executeQuery(String sql) |
|
int |
executeUpdate() |
|
int |
executeUpdate(String sql) |
|
ResultSetMetaData |
getMetaData() |
|
ParameterMetaData |
getParameterMetaData() |
|
ParameterMetaData |
getParameterMetaData(boolean forceRefresh) |
Returns parameter metadata for the prepared statement.
|
int |
getPreparedStatementHandle() |
The server handle for this prepared statement.
|
void |
setArray(int i,
Array x) |
|
void |
setAsciiStream(int parameterIndex,
InputStream x) |
|
void |
setAsciiStream(int n,
InputStream x,
int length) |
|
void |
setAsciiStream(int parameterIndex,
InputStream x,
long length) |
|
void |
setBigDecimal(int paramterIndex,
BigDecimal x) |
|
void |
setBigDecimal(int paramterIndex,
BigDecimal x,
int precision,
int scale) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setBigDecimal(int paramterIndex,
BigDecimal x,
int precision,
int scale,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setBinaryStream(int parameterIndex,
InputStream x) |
|
void |
setBinaryStream(int n,
InputStream x,
int length) |
|
void |
setBinaryStream(int parameterIndex,
InputStream x,
long length) |
|
void |
setBlob(int parameterIndex,
InputStream inputStream) |
|
void |
setBlob(int parameterIndex,
InputStream inputStream,
long length) |
|
void |
setBlob(int i,
Blob x) |
|
void |
setBoolean(int n,
boolean x) |
|
void |
setBoolean(int n,
boolean x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
boolean value. |
void |
setByte(int n,
byte x) |
|
void |
setByte(int n,
byte x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
byte value. |
void |
setBytes(int n,
byte[] x) |
|
void |
setBytes(int n,
byte[] x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java array of bytes.
|
void |
setCharacterStream(int parameterIndex,
Reader reader) |
|
void |
setCharacterStream(int n,
Reader reader,
int length) |
|
void |
setCharacterStream(int parameterIndex,
Reader reader,
long length) |
|
void |
setClob(int parameterIndex,
Reader reader) |
|
void |
setClob(int parameterIndex,
Reader reader,
long length) |
|
void |
setClob(int parameterIndex,
Clob clobValue) |
|
void |
setDate(int n,
Date x) |
|
void |
setDate(int n,
Date x,
Calendar cal) |
|
void |
setDate(int n,
Date x,
Calendar cal,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Date value, using the given
Calendar object. |
void |
setDateTime(int n,
Timestamp x) |
Sets the designated parameter to the given
java.sql.Timestamp value. |
void |
setDateTime(int n,
Timestamp x,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Timestamp value. |
void |
setDateTimeOffset(int n,
DateTimeOffset x) |
Sets the designated parameter to the given
microsoft.sql.DateTimeOffset value. |
void |
setDateTimeOffset(int n,
DateTimeOffset x,
int scale) |
Sets the designated parameter to the given
microsoft.sql.DatetimeOffset value. |
void |
setDateTimeOffset(int n,
DateTimeOffset x,
int scale,
boolean forceEncrypt) |
Sets the designated parameter to the given
microsoft.sql.DatetimeOffset value. |
void |
setDouble(int n,
double x) |
|
void |
setDouble(int n,
double x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
double value. |
void |
setFloat(int n,
float x) |
|
void |
setFloat(int n,
float x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
float value. |
void |
setGeography(int n,
Geography x) |
Sets the designated parameter to the given
microsoft.sql.Geography Class object. |
void |
setGeometry(int n,
Geometry x) |
Sets the designated parameter to the given
microsoft.sql.Geometry Class object. |
void |
setInt(int n,
int value) |
|
void |
setInt(int n,
int value,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
int value. |
void |
setLong(int n,
long x) |
|
void |
setLong(int n,
long x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
long value. |
void |
setMoney(int n,
BigDecimal x) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setMoney(int n,
BigDecimal x,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setNCharacterStream(int parameterIndex,
Reader value) |
|
void |
setNCharacterStream(int parameterIndex,
Reader value,
long length) |
|
void |
setNClob(int parameterIndex,
Reader reader) |
|
void |
setNClob(int parameterIndex,
Reader reader,
long length) |
|
void |
setNClob(int parameterIndex,
NClob value) |
|
void |
setNString(int parameterIndex,
String value) |
|
void |
setNString(int parameterIndex,
String value,
boolean forceEncrypt) |
Sets the designated parameter to the given
String object. |
void |
setNull(int index,
int jdbcType) |
|
void |
setNull(int paramIndex,
int sqlType,
String typeName) |
|
void |
setObject(int index,
Object obj) |
|
void |
setObject(int n,
Object obj,
int jdbcType) |
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType,
int scaleOrLength) |
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType,
Integer precision,
int scale) |
Sets the value of the designated parameter with the given object.
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType,
Integer precision,
int scale,
boolean forceEncrypt) |
Sets the value of the designated parameter with the given object.
|
void |
setObject(int index,
Object obj,
SQLType jdbcType) |
|
void |
setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
int scaleOrLength) |
|
void |
setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
Integer precision,
Integer scale) |
Sets the value of the designated parameter with the given object.
|
void |
setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
Integer precision,
Integer scale,
boolean forceEncrypt) |
Sets the value of the designated parameter with the given object.
|
void |
setRef(int i,
Ref x) |
|
void |
setRowId(int parameterIndex,
RowId x) |
|
void |
setShort(int index,
short x) |
|
void |
setShort(int index,
short x,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
short value. |
void |
setSmallDateTime(int n,
Timestamp x) |
Sets the designated parameter to the given
java.sql.Timestamp value. |
void |
setSmallDateTime(int n,
Timestamp x,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Timestamp value. |
void |
setSmallMoney(int n,
BigDecimal x) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setSmallMoney(int n,
BigDecimal x,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setSQLXML(int parameterIndex,
SQLXML xmlObject) |
|
void |
setString(int index,
String str) |
|
void |
setString(int index,
String str,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
String value. |
void |
setStructured(int n,
String tvpName,
ISQLServerDataRecord tvpBulkRecord) |
Sets the server bulk record to populate a table valued parameter.
|
void |
setStructured(int n,
String tvpName,
SQLServerDataTable tvpDataTable) |
Sets the data table to populates a table valued parameter.
|
void |
setStructured(int n,
String tvpName,
ResultSet tvpResultSet) |
Sets the result set to populate a table-valued parameter.
|
void |
setTime(int n,
Time x) |
|
void |
setTime(int n,
Time x,
int scale) |
Sets the designated parameter to the given
java.sql.Time value. |
void |
setTime(int n,
Time x,
int scale,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Time value. |
void |
setTime(int n,
Time x,
Calendar cal) |
|
void |
setTime(int n,
Time x,
Calendar cal,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Time value. |
void |
setTimestamp(int n,
Timestamp x) |
|
void |
setTimestamp(int n,
Timestamp x,
int scale) |
Sets the designated parameter to the given
java.sql.Timestamp value. |
void |
setTimestamp(int n,
Timestamp x,
int scale,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Timestamp value. |
void |
setTimestamp(int n,
Timestamp x,
Calendar cal) |
|
void |
setTimestamp(int n,
Timestamp x,
Calendar cal,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Timestamp value. |
void |
setUnicodeStream(int n,
InputStream x,
int length) |
Deprecated.
|
void |
setUniqueIdentifier(int index,
String guid) |
Sets the designated parameter to the given String.
|
void |
setUniqueIdentifier(int index,
String guid,
boolean forceEncrypt) |
Sets the designated parameter to the given String.
|
void |
setURL(int parameterIndex,
URL x) |
getCancelQueryTimeout, getResponseBuffering, setCancelQueryTimeout, setResponseBufferingclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcancel, clearWarnings, close, closeOnCompletion, execute, execute, execute, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeUpdate, executeUpdate, executeUpdate, getCancelQueryTimeout, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResponseBuffering, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getStmtColumnEncriptionSetting, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, setCancelQueryTimeout, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, setResponseBuffering, toString, unwrapcancel, clearWarnings, close, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, 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, setQueryTimeoutisWrapperFor, unwrappublic int getPreparedStatementHandle()
throws SQLServerException
ISQLServerPreparedStatementgetPreparedStatementHandle in interface ISQLServerPreparedStatementSQLServerException - when an error occurspublic final void clearParameters()
throws SQLServerException
clearParameters in interface PreparedStatementSQLServerExceptionpublic ResultSet executeQuery() throws SQLServerException, SQLTimeoutException
executeQuery in interface PreparedStatementSQLServerExceptionSQLTimeoutExceptionpublic int executeUpdate()
throws SQLServerException,
SQLTimeoutException
executeUpdate in interface PreparedStatementSQLServerExceptionSQLTimeoutExceptionpublic long executeLargeUpdate()
throws SQLServerException,
SQLTimeoutException
executeLargeUpdate in interface PreparedStatementSQLServerExceptionSQLTimeoutExceptionpublic boolean execute()
throws SQLServerException,
SQLTimeoutException
execute in interface PreparedStatementSQLServerExceptionSQLTimeoutExceptionpublic final ResultSetMetaData getMetaData() throws SQLServerException
getMetaData in interface PreparedStatementSQLServerExceptionpublic final void setAsciiStream(int parameterIndex,
InputStream x)
throws SQLException
setAsciiStream in interface PreparedStatementSQLExceptionpublic final void setAsciiStream(int n,
InputStream x,
int length)
throws SQLServerException
setAsciiStream in interface PreparedStatementSQLServerExceptionpublic final void setAsciiStream(int parameterIndex,
InputStream x,
long length)
throws SQLException
setAsciiStream in interface PreparedStatementSQLExceptionpublic final void setBigDecimal(int paramterIndex,
BigDecimal x)
throws SQLServerException
setBigDecimal in interface PreparedStatementSQLServerExceptionpublic final void setBigDecimal(int paramterIndex,
BigDecimal x,
int precision,
int scale)
throws SQLServerException
ISQLServerPreparedStatementjava.math.BigDecimal value. The driver converts this to
an SQL NUMERIC value when it sends it to the database.setBigDecimal in interface ISQLServerPreparedStatementparamterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueprecision - the precision of the columnscale - the scale of the columnSQLServerException - when an error occurspublic final void setBigDecimal(int paramterIndex,
BigDecimal x,
int precision,
int scale,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.math.BigDecimal value. The driver converts this to
an SQL NUMERIC value when it sends it to the database.setBigDecimal in interface ISQLServerPreparedStatementparamterIndex - the first parameter is 1, the second is 2, ...x - the parameter valueprecision - the precision of the columnscale - the scale of the columnforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setMoney(int n,
BigDecimal x)
throws SQLServerException
ISQLServerPreparedStatementjava.math.BigDecimal value. The driver converts this to
an SQL NUMERIC value when it sends it to the database.setMoney in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueSQLServerException - when an error occurspublic final void setMoney(int n,
BigDecimal x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.math.BigDecimal value. The driver converts this to
an SQL NUMERIC value when it sends it to the database.setMoney in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setSmallMoney(int n,
BigDecimal x)
throws SQLServerException
ISQLServerPreparedStatementjava.math.BigDecimal value. The driver converts this to
an SQL NUMERIC value when it sends it to the database.setSmallMoney in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueSQLServerException - when an error occurspublic final void setSmallMoney(int n,
BigDecimal x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.math.BigDecimal value. The driver converts this to
an SQL NUMERIC value when it sends it to the database.setSmallMoney in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setBinaryStream(int parameterIndex,
InputStream x)
throws SQLException
setBinaryStream in interface PreparedStatementSQLExceptionpublic final void setBinaryStream(int n,
InputStream x,
int length)
throws SQLServerException
setBinaryStream in interface PreparedStatementSQLServerExceptionpublic final void setBinaryStream(int parameterIndex,
InputStream x,
long length)
throws SQLException
setBinaryStream in interface PreparedStatementSQLExceptionpublic final void setBoolean(int n,
boolean x)
throws SQLServerException
setBoolean in interface PreparedStatementSQLServerExceptionpublic final void setBoolean(int n,
boolean x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementboolean value. The driver converts this to an SQL
BIT or BOOLEAN value when it sends it to the database.setBoolean in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setByte(int n,
byte x)
throws SQLServerException
setByte in interface PreparedStatementSQLServerExceptionpublic final void setByte(int n,
byte x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementbyte value. The driver converts this to an SQL
TINYINT value when it sends it to the database.setByte in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setBytes(int n,
byte[] x)
throws SQLServerException
setBytes in interface PreparedStatementSQLServerExceptionpublic final void setBytes(int n,
byte[] x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementVARBINARY or LONGVARBINARY (depending on the argument's size relative to the driver's
limits on VARBINARY values) when it sends it to the database.setBytes in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setUniqueIdentifier(int index,
String guid)
throws SQLServerException
ISQLServerPreparedStatementGUIDsetUniqueIdentifier in interface ISQLServerPreparedStatementindex - the first parameter is 1, the second is 2, ...guid - string representation of the uniqueIdentifier valueSQLServerException - when an error occurspublic final void setUniqueIdentifier(int index,
String guid,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementGUIDsetUniqueIdentifier in interface ISQLServerPreparedStatementindex - the first parameter is 1, the second is 2, ...guid - string representation of the uniqueIdentifier valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setDouble(int n,
double x)
throws SQLServerException
setDouble in interface PreparedStatementSQLServerExceptionpublic final void setDouble(int n,
double x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementdouble value. The driver converts this to an SQL
DOUBLE value when it sends it to the database.setDouble in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setFloat(int n,
float x)
throws SQLServerException
setFloat in interface PreparedStatementSQLServerExceptionpublic final void setFloat(int n,
float x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementfloat value. The driver converts this to an SQL
REAL value when it sends it to the database.setFloat in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setGeometry(int n,
Geometry x)
throws SQLServerException
ISQLServerPreparedStatementmicrosoft.sql.Geometry Class object. The driver converts
this to an SQL REAL value when it sends it to the database.setGeometry in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueSQLServerException - when an error occurspublic final void setGeography(int n,
Geography x)
throws SQLServerException
ISQLServerPreparedStatementmicrosoft.sql.Geography Class object. The driver converts
this to an SQL REAL value when it sends it to the database.setGeography in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueSQLServerException - when an error occurspublic final void setInt(int n,
int value)
throws SQLServerException
setInt in interface PreparedStatementSQLServerExceptionpublic final void setInt(int n,
int value,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementint value. The driver converts this to an SQL
INTEGER value when it sends it to the database.setInt in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...value - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setLong(int n,
long x)
throws SQLServerException
setLong in interface PreparedStatementSQLServerExceptionpublic final void setLong(int n,
long x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementlong value. The driver converts this to an SQL
BIGINT value when it sends it to the database.setLong in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setNull(int index,
int jdbcType)
throws SQLServerException
setNull in interface PreparedStatementSQLServerExceptionpublic final void setObject(int index,
Object obj)
throws SQLServerException
setObject in interface PreparedStatementSQLServerExceptionpublic final void setObject(int n,
Object obj,
int jdbcType)
throws SQLServerException
setObject in interface PreparedStatementSQLServerExceptionpublic final void setObject(int parameterIndex,
Object x,
int targetSqlType,
int scaleOrLength)
throws SQLServerException
setObject in interface PreparedStatementSQLServerExceptionpublic final void setObject(int parameterIndex,
Object x,
int targetSqlType,
Integer precision,
int scale)
throws SQLServerException
ISQLServerPreparedStatement
The given Java object will be converted to the given targetSqlType before being sent to the database.
If the object has a custom mapping (is of a class implementing the interface SQLData), the JDBC
driver should call the method SQLData.writeSQL to write it to the SQL data stream. If, on the other
hand, the object is of a class implementing Ref, Blob, Clob,
NClob, Struct, java.net.URL, or Array, the driver should pass
it to the database as a value of the corresponding SQL type.
Note that this method may be used to pass database-specific abstract data types.
setObject in interface ISQLServerPreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the object containing the input parameter valuetargetSqlType - the SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further
qualify this type.precision - the precision of the columnscale - scale of the columnSQLServerException - when an error occurspublic final void setObject(int parameterIndex,
Object x,
int targetSqlType,
Integer precision,
int scale,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatement
The given Java object will be converted to the given targetSqlType before being sent to the database.
If the object has a custom mapping (is of a class implementing the interface SQLData), the JDBC
driver should call the method SQLData.writeSQL to write it to the SQL data stream. If, on the other
hand, the object is of a class implementing Ref, Blob, Clob,
NClob, Struct, java.net.URL, or Array, the driver should pass
it to the database as a value of the corresponding SQL type.
Note that this method may be used to pass database-specific abstract data types.
setObject in interface ISQLServerPreparedStatementparameterIndex - the first parameter is 1, the second is 2, ...x - the object containing the input parameter valuetargetSqlType - the SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further
qualify this type.precision - the precision of the columnscale - scale of the columnforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setObject(int index,
Object obj,
SQLType jdbcType)
throws SQLServerException
setObject in interface PreparedStatementSQLServerExceptionpublic final void setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
int scaleOrLength)
throws SQLServerException
setObject in interface PreparedStatementSQLServerExceptionpublic final void setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
Integer precision,
Integer scale)
throws SQLServerException
ISQLServerPreparedStatementPreparedStatement.setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength), except that it
assumes a scale of zero.
The default implementation will throw SQLFeatureNotSupportedException
setObject in interface ISQLServerPreparedStatementparameterIndex - 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 databaseprecision - the precision of the columnscale - the scale of the columnSQLServerException - 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 final void setObject(int parameterIndex,
Object x,
SQLType targetSqlType,
Integer precision,
Integer scale,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementPreparedStatement.setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength), except that it
assumes a scale of zero.
The default implementation will throw SQLFeatureNotSupportedException
setObject in interface ISQLServerPreparedStatementparameterIndex - 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 databaseprecision - the precision of the columnscale - the scale of the columnforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - 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 final void setShort(int index,
short x)
throws SQLServerException
setShort in interface PreparedStatementSQLServerExceptionpublic final void setShort(int index,
short x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementshort value. The driver converts this to an SQL
SMALLINT value when it sends it to the database.setShort in interface ISQLServerPreparedStatementindex - the first parameter is 1, the second is 2, ...x - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setString(int index,
String str)
throws SQLServerException
setString in interface PreparedStatementSQLServerExceptionpublic final void setString(int index,
String str,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementString value. The driver converts this to an SQL
VARCHAR or LONGVARCHAR value (depending on the argument's size relative to the driver's
limits on VARCHAR values) when it sends it to the database.setString in interface ISQLServerPreparedStatementindex - the first parameter is 1, the second is 2, ...str - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setNString(int parameterIndex,
String value)
throws SQLException
setNString in interface PreparedStatementSQLExceptionpublic final void setNString(int parameterIndex,
String value,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementString 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 ISQLServerPreparedStatementparameterIndex - of the first parameter is 1, the second is 2, ...value - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setTime(int n,
Time x)
throws SQLServerException
setTime in interface PreparedStatementSQLServerExceptionpublic final void setTime(int n,
Time x,
int scale)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Time value.setTime in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valuescale - the scale of the columnSQLServerException - when an error occurspublic final void setTime(int n,
Time x,
int scale,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Time value.setTime in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valuescale - the scale of the columnforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setTimestamp(int n,
Timestamp x)
throws SQLServerException
setTimestamp in interface PreparedStatementSQLServerExceptionpublic final void setTimestamp(int n,
Timestamp x,
int scale)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp value.setTimestamp in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valuescale - the scale of the columnSQLServerException - when an error occurspublic final void setTimestamp(int n,
Timestamp x,
int scale,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp value.setTimestamp in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valuescale - the scale of the columnforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setDateTimeOffset(int n,
DateTimeOffset x)
throws SQLServerException
ISQLServerPreparedStatementmicrosoft.sql.DateTimeOffset value.setDateTimeOffset in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueSQLServerException - 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 final void setDateTimeOffset(int n,
DateTimeOffset x,
int scale)
throws SQLServerException
ISQLServerPreparedStatementmicrosoft.sql.DatetimeOffset value.setDateTimeOffset in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valuescale - the scale of the columnSQLServerException - when an error occurspublic final void setDateTimeOffset(int n,
DateTimeOffset x,
int scale,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementmicrosoft.sql.DatetimeOffset value.setDateTimeOffset in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valuescale - the scale of the columnforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setDate(int n,
Date x)
throws SQLServerException
setDate in interface PreparedStatementSQLServerExceptionpublic final void setDateTime(int n,
Timestamp x)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp value.setDateTime in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueSQLServerException - when an error occurspublic final void setDateTime(int n,
Timestamp x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp value.setDateTime in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setSmallDateTime(int n,
Timestamp x)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp value.setSmallDateTime in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueSQLServerException - when an error occurspublic final void setSmallDateTime(int n,
Timestamp x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp value.setSmallDateTime in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valueforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setStructured(int n,
String tvpName,
SQLServerDataTable tvpDataTable)
throws SQLServerException
ISQLServerPreparedStatementsetStructured in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...tvpName - the name of the table valued parametertvpDataTable - the source datatable objectSQLServerException - when an error occurspublic final void setStructured(int n,
String tvpName,
ResultSet tvpResultSet)
throws SQLServerException
ISQLServerPreparedStatementsetStructured in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...tvpName - the name of the table valued parametertvpResultSet - the source resultset objectSQLServerException - when an error occurspublic final void setStructured(int n,
String tvpName,
ISQLServerDataRecord tvpBulkRecord)
throws SQLServerException
ISQLServerPreparedStatementsetStructured in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...tvpName - the name of the table valued parametertvpBulkRecord - an ISQLServerDataRecord objectSQLServerException - when an error occurs@Deprecated public final void setUnicodeStream(int n, InputStream x, int length) throws SQLException
setUnicodeStream in interface PreparedStatementSQLExceptionpublic final void addBatch()
throws SQLServerException
addBatch in interface PreparedStatementSQLServerExceptionpublic final void clearBatch()
throws SQLServerException
clearBatch in interface StatementclearBatch in class SQLServerStatementSQLServerExceptionpublic int[] executeBatch()
throws SQLServerException,
BatchUpdateException,
SQLTimeoutException
SQLServerStatementexecuteBatch in interface StatementexecuteBatch in class SQLServerStatementSQLServerExceptionBatchUpdateExceptionSQLTimeoutExceptionpublic long[] executeLargeBatch()
throws SQLServerException,
BatchUpdateException,
SQLTimeoutException
executeLargeBatch in interface StatementexecuteLargeBatch in class SQLServerStatementSQLServerExceptionBatchUpdateExceptionSQLTimeoutExceptionpublic final void setCharacterStream(int parameterIndex,
Reader reader)
throws SQLException
setCharacterStream in interface PreparedStatementSQLExceptionpublic final void setCharacterStream(int n,
Reader reader,
int length)
throws SQLServerException
setCharacterStream in interface PreparedStatementSQLServerExceptionpublic final void setCharacterStream(int parameterIndex,
Reader reader,
long length)
throws SQLException
setCharacterStream in interface PreparedStatementSQLExceptionpublic final void setNCharacterStream(int parameterIndex,
Reader value)
throws SQLException
setNCharacterStream in interface PreparedStatementSQLExceptionpublic final void setNCharacterStream(int parameterIndex,
Reader value,
long length)
throws SQLException
setNCharacterStream in interface PreparedStatementSQLExceptionpublic final void setRef(int i,
Ref x)
throws SQLException
setRef in interface PreparedStatementSQLExceptionpublic final void setBlob(int i,
Blob x)
throws SQLException
setBlob in interface PreparedStatementSQLExceptionpublic final void setBlob(int parameterIndex,
InputStream inputStream)
throws SQLException
setBlob in interface PreparedStatementSQLExceptionpublic final void setBlob(int parameterIndex,
InputStream inputStream,
long length)
throws SQLException
setBlob in interface PreparedStatementSQLExceptionpublic final void setClob(int parameterIndex,
Clob clobValue)
throws SQLException
setClob in interface PreparedStatementSQLExceptionpublic final void setClob(int parameterIndex,
Reader reader)
throws SQLException
setClob in interface PreparedStatementSQLExceptionpublic final void setClob(int parameterIndex,
Reader reader,
long length)
throws SQLException
setClob in interface PreparedStatementSQLExceptionpublic final void setNClob(int parameterIndex,
NClob value)
throws SQLException
setNClob in interface PreparedStatementSQLExceptionpublic final void setNClob(int parameterIndex,
Reader reader)
throws SQLException
setNClob in interface PreparedStatementSQLExceptionpublic final void setNClob(int parameterIndex,
Reader reader,
long length)
throws SQLException
setNClob in interface PreparedStatementSQLExceptionpublic final void setArray(int i,
Array x)
throws SQLException
setArray in interface PreparedStatementSQLExceptionpublic final void setDate(int n,
Date x,
Calendar cal)
throws SQLServerException
setDate in interface PreparedStatementSQLServerExceptionpublic final void setDate(int n,
Date x,
Calendar cal,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Date value, using the given
Calendar object. The driver uses the Calendar object to construct an SQL
DATE value, which the driver then sends to the database. With a Calendar object, the
driver can calculate the date taking into account a custom timezone. If no Calendar object is
specified, the driver uses the default timezone, which is that of the virtual machine running the application.setDate in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valuecal - the Calendar object the driver will use to construct the dateforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setTime(int n,
Time x,
Calendar cal)
throws SQLServerException
setTime in interface PreparedStatementSQLServerExceptionpublic final void setTime(int n,
Time x,
Calendar cal,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Time value. The driver converts this to an SQL
TIME value when it sends it to the database.setTime in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valuecal - the Calendar object the driver will use to construct the dateforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setTimestamp(int n,
Timestamp x,
Calendar cal)
throws SQLServerException
setTimestamp in interface PreparedStatementSQLServerExceptionpublic final void setTimestamp(int n,
Timestamp x,
Calendar cal,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp value. The driver converts this to an
SQL TIMESTAMP value when it sends it to the database.setTimestamp in interface ISQLServerPreparedStatementn - the first parameter is 1, the second is 2, ...x - the parameter valuecal - the Calendar object the driver will use to construct the dateforceEncrypt - If the boolean forceEncrypt is set to true, the query parameter will only be set if the designation column
is encrypted and Always Encrypted is enabled on the connection or on the statement. If the boolean
forceEncrypt is set to false, the driver will not force encryption on parameters.SQLServerException - when an error occurspublic final void setNull(int paramIndex,
int sqlType,
String typeName)
throws SQLServerException
setNull in interface PreparedStatementSQLServerExceptionpublic final ParameterMetaData getParameterMetaData(boolean forceRefresh) throws SQLServerException
ISQLServerPreparedStatementgetParameterMetaData in interface ISQLServerPreparedStatementforceRefresh - :
If true the cache will not be used to retrieve the metadata.SQLServerException - when an error occurspublic final ParameterMetaData getParameterMetaData() throws SQLServerException
getParameterMetaData in interface PreparedStatementSQLServerExceptionpublic final void setURL(int parameterIndex,
URL x)
throws SQLException
setURL in interface PreparedStatementSQLExceptionpublic final void setRowId(int parameterIndex,
RowId x)
throws SQLException
setRowId in interface PreparedStatementSQLExceptionpublic final void setSQLXML(int parameterIndex,
SQLXML xmlObject)
throws SQLException
setSQLXML in interface PreparedStatementSQLExceptionpublic final int executeUpdate(String sql) throws SQLServerException
executeUpdate in interface StatementexecuteUpdate in class SQLServerStatementSQLServerExceptionpublic final boolean execute(String sql) throws SQLServerException
execute in interface Statementexecute in class SQLServerStatementSQLServerExceptionpublic final ResultSet executeQuery(String sql) throws SQLServerException
executeQuery in interface StatementexecuteQuery in class SQLServerStatementSQLServerExceptionpublic void addBatch(String sql) throws SQLServerException
addBatch in interface StatementaddBatch in class SQLServerStatementSQLServerExceptionCopyright © 2018 Microsoft Corporation. All rights reserved.