ISQLServerPreparedStatement, ISQLServerStatement, java.lang.AutoCloseable, java.sql.PreparedStatement, java.sql.Statement, java.sql.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.
stmtColumnEncriptionSetting| Modifier and Type | Method | Description |
|---|---|---|
void |
addBatch() |
|
void |
addBatch(java.lang.String sql) |
|
void |
clearBatch() |
|
void |
clearParameters() |
|
boolean |
execute() |
|
boolean |
execute(java.lang.String sql) |
|
int[] |
executeBatch() |
Send a batch of statements to the database.
|
long[] |
executeLargeBatch() |
|
long |
executeLargeUpdate() |
|
java.sql.ResultSet |
executeQuery() |
|
java.sql.ResultSet |
executeQuery(java.lang.String sql) |
|
int |
executeUpdate() |
|
int |
executeUpdate(java.lang.String sql) |
|
java.sql.ResultSetMetaData |
getMetaData() |
|
java.sql.ParameterMetaData |
getParameterMetaData() |
|
java.sql.ParameterMetaData |
getParameterMetaData(boolean forceRefresh) |
Returns parameter metadata for the prepared statement.
|
int |
getPreparedStatementHandle() |
The server handle for this prepared statement.
|
void |
setArray(int i,
java.sql.Array x) |
|
void |
setAsciiStream(int parameterIndex,
java.io.InputStream x) |
|
void |
setAsciiStream(int n,
java.io.InputStream x,
int length) |
|
void |
setAsciiStream(int parameterIndex,
java.io.InputStream x,
long length) |
|
void |
setBigDecimal(int paramterIndex,
java.math.BigDecimal x) |
|
void |
setBigDecimal(int paramterIndex,
java.math.BigDecimal x,
int precision,
int scale) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setBigDecimal(int paramterIndex,
java.math.BigDecimal x,
int precision,
int scale,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setBinaryStream(int parameterIndex,
java.io.InputStream x) |
|
void |
setBinaryStream(int n,
java.io.InputStream x,
int length) |
|
void |
setBinaryStream(int parameterIndex,
java.io.InputStream x,
long length) |
|
void |
setBlob(int parameterIndex,
java.io.InputStream inputStream) |
|
void |
setBlob(int parameterIndex,
java.io.InputStream inputStream,
long length) |
|
void |
setBlob(int i,
java.sql.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,
java.io.Reader reader) |
|
void |
setCharacterStream(int n,
java.io.Reader reader,
int length) |
|
void |
setCharacterStream(int parameterIndex,
java.io.Reader reader,
long length) |
|
void |
setClob(int parameterIndex,
java.io.Reader reader) |
|
void |
setClob(int parameterIndex,
java.io.Reader reader,
long length) |
|
void |
setClob(int parameterIndex,
java.sql.Clob clobValue) |
|
void |
setDate(int n,
java.sql.Date x) |
|
void |
setDate(int n,
java.sql.Date x,
java.util.Calendar cal) |
|
void |
setDate(int n,
java.sql.Date x,
java.util.Calendar cal,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Date value, using the given Calendar object. |
void |
setDateTime(int n,
java.sql.Timestamp x) |
Sets the designated parameter to the given
java.sql.Timestamp value |
void |
setDateTime(int n,
java.sql.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,
java.math.BigDecimal x) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setMoney(int n,
java.math.BigDecimal x,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setNCharacterStream(int parameterIndex,
java.io.Reader value) |
|
void |
setNCharacterStream(int parameterIndex,
java.io.Reader value,
long length) |
|
void |
setNClob(int parameterIndex,
java.io.Reader reader) |
|
void |
setNClob(int parameterIndex,
java.io.Reader reader,
long length) |
|
void |
setNClob(int parameterIndex,
java.sql.NClob value) |
|
void |
setNString(int parameterIndex,
java.lang.String value) |
|
void |
setNString(int parameterIndex,
java.lang.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,
java.lang.String typeName) |
|
void |
setObject(int index,
java.lang.Object obj) |
|
void |
setObject(int n,
java.lang.Object obj,
int jdbcType) |
|
void |
setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType,
int scaleOrLength) |
|
void |
setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType,
java.lang.Integer precision,
int scale) |
Sets the value of the designated parameter with the given object.
|
void |
setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType,
java.lang.Integer precision,
int scale,
boolean forceEncrypt) |
Sets the value of the designated parameter with the given object.
|
void |
setObject(int index,
java.lang.Object obj,
java.sql.SQLType jdbcType) |
|
void |
setObject(int parameterIndex,
java.lang.Object x,
java.sql.SQLType targetSqlType,
int scaleOrLength) |
|
void |
setObject(int parameterIndex,
java.lang.Object x,
java.sql.SQLType targetSqlType,
java.lang.Integer precision,
java.lang.Integer scale) |
Sets the value of the designated parameter with the given object.
|
void |
setObject(int parameterIndex,
java.lang.Object x,
java.sql.SQLType targetSqlType,
java.lang.Integer precision,
java.lang.Integer scale,
boolean forceEncrypt) |
Sets the value of the designated parameter with the given object.
|
void |
setRef(int i,
java.sql.Ref x) |
|
void |
setRowId(int parameterIndex,
java.sql.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,
java.sql.Timestamp x) |
Sets the designated parameter to the given
java.sql.Timestamp value |
void |
setSmallDateTime(int n,
java.sql.Timestamp x,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Timestamp value |
void |
setSmallMoney(int n,
java.math.BigDecimal x) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setSmallMoney(int n,
java.math.BigDecimal x,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.math.BigDecimal value. |
void |
setSQLXML(int parameterIndex,
java.sql.SQLXML xmlObject) |
|
void |
setString(int index,
java.lang.String str) |
|
void |
setString(int index,
java.lang.String str,
boolean forceEncrypt) |
Sets the designated parameter to the given Java
String value. |
void |
setStructured(int n,
java.lang.String tvpName,
ISQLServerDataRecord tvpBulkRecord) |
Populates a table valued parameter with a data table
|
void |
setStructured(int n,
java.lang.String tvpName,
SQLServerDataTable tvpDataTable) |
Populates a table valued parameter with a data table
|
void |
setStructured(int n,
java.lang.String tvpName,
java.sql.ResultSet tvpResultSet) |
Populates a table valued parameter with a data table
|
void |
setTime(int n,
java.sql.Time x) |
|
void |
setTime(int n,
java.sql.Time x,
int scale) |
Sets the designated parameter to the given
java.sql.Time value |
void |
setTime(int n,
java.sql.Time x,
int scale,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Time value |
void |
setTime(int n,
java.sql.Time x,
java.util.Calendar cal) |
|
void |
setTime(int n,
java.sql.Time x,
java.util.Calendar cal,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Time value. |
void |
setTimestamp(int n,
java.sql.Timestamp x) |
|
void |
setTimestamp(int n,
java.sql.Timestamp x,
int scale) |
Sets the designated parameter to the given
java.sql.Timestamp value |
void |
setTimestamp(int n,
java.sql.Timestamp x,
int scale,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Timestamp value |
void |
setTimestamp(int n,
java.sql.Timestamp x,
java.util.Calendar cal) |
|
void |
setTimestamp(int n,
java.sql.Timestamp x,
java.util.Calendar cal,
boolean forceEncrypt) |
Sets the designated parameter to the given
java.sql.Timestamp value. |
void |
setUnicodeStream(int n,
java.io.InputStream x,
int length) |
Deprecated.
|
void |
setUniqueIdentifier(int index,
java.lang.String guid) |
Sets the designated parameter to the given String.
|
void |
setUniqueIdentifier(int index,
java.lang.String guid,
boolean forceEncrypt) |
Sets the designated parameter to the given String.
|
void |
setURL(int parameterIndex,
java.net.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, setQueryTimeoutpublic int getPreparedStatementHandle()
throws SQLServerException
ISQLServerPreparedStatementgetPreparedStatementHandle in interface ISQLServerPreparedStatementSQLServerException - when an error occurspublic final void clearParameters()
throws SQLServerException
clearParameters in interface java.sql.PreparedStatementSQLServerExceptionpublic java.sql.ResultSet executeQuery()
throws SQLServerException,
java.sql.SQLTimeoutException
executeQuery in interface java.sql.PreparedStatementSQLServerExceptionjava.sql.SQLTimeoutExceptionpublic int executeUpdate()
throws SQLServerException,
java.sql.SQLTimeoutException
executeUpdate in interface java.sql.PreparedStatementSQLServerExceptionjava.sql.SQLTimeoutExceptionpublic long executeLargeUpdate()
throws SQLServerException,
java.sql.SQLTimeoutException
executeLargeUpdate in interface java.sql.PreparedStatementSQLServerExceptionjava.sql.SQLTimeoutExceptionpublic boolean execute()
throws SQLServerException,
java.sql.SQLTimeoutException
execute in interface java.sql.PreparedStatementSQLServerExceptionjava.sql.SQLTimeoutExceptionpublic final java.sql.ResultSetMetaData getMetaData()
throws SQLServerException
getMetaData in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setAsciiStream(int parameterIndex,
java.io.InputStream x)
throws java.sql.SQLException
setAsciiStream in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setAsciiStream(int n,
java.io.InputStream x,
int length)
throws SQLServerException
setAsciiStream in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setAsciiStream(int parameterIndex,
java.io.InputStream x,
long length)
throws java.sql.SQLException
setAsciiStream in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setBigDecimal(int paramterIndex,
java.math.BigDecimal x)
throws SQLServerException
setBigDecimal in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setBigDecimal(int paramterIndex,
java.math.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,
java.math.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,
java.math.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,
java.math.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,
java.math.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,
java.math.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,
java.io.InputStream x)
throws java.sql.SQLException
setBinaryStream in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setBinaryStream(int n,
java.io.InputStream x,
int length)
throws SQLServerException
setBinaryStream in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setBinaryStream(int parameterIndex,
java.io.InputStream x,
long length)
throws java.sql.SQLException
setBinaryStream in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setBoolean(int n,
boolean x)
throws SQLServerException
setBoolean in interface java.sql.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 java.sql.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 java.sql.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,
java.lang.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,
java.lang.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 java.sql.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 java.sql.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 java.sql.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 java.sql.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 java.sql.PreparedStatementSQLServerExceptionpublic final void setObject(int index,
java.lang.Object obj)
throws SQLServerException
setObject in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setObject(int n,
java.lang.Object obj,
int jdbcType)
throws SQLServerException
setObject in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType,
int scaleOrLength)
throws SQLServerException
setObject in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType,
java.lang.Integer precision,
int scale)
throws SQLServerException
ISQLServerPreparedStatementSets the value of the designated parameter with the given object.
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,
java.lang.Object x,
int targetSqlType,
java.lang.Integer precision,
int scale,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementSets the value of the designated parameter with the given object.
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,
java.lang.Object obj,
java.sql.SQLType jdbcType)
throws SQLServerException
setObject in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setObject(int parameterIndex,
java.lang.Object x,
java.sql.SQLType targetSqlType,
int scaleOrLength)
throws SQLServerException
setObject in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setObject(int parameterIndex,
java.lang.Object x,
java.sql.SQLType targetSqlType,
java.lang.Integer precision,
java.lang.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,
java.lang.Object x,
java.sql.SQLType targetSqlType,
java.lang.Integer precision,
java.lang.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 java.sql.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,
java.lang.String str)
throws SQLServerException
setString in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setString(int index,
java.lang.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,
java.lang.String value)
throws java.sql.SQLException
setNString in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setNString(int parameterIndex,
java.lang.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,
java.sql.Time x)
throws SQLServerException
setTime in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setTime(int n,
java.sql.Time x,
int scale)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Time valuesetTime 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,
java.sql.Time x,
int scale,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Time valuesetTime 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,
java.sql.Timestamp x)
throws SQLServerException
setTimestamp in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setTimestamp(int n,
java.sql.Timestamp x,
int scale)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp valuesetTimestamp 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,
java.sql.Timestamp x,
int scale,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp valuesetTimestamp 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 valuesetDateTimeOffset 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 valuesetDateTimeOffset 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,
java.sql.Date x)
throws SQLServerException
setDate in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setDateTime(int n,
java.sql.Timestamp x)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp valuesetDateTime 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,
java.sql.Timestamp x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp valuesetDateTime 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,
java.sql.Timestamp x)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp valuesetSmallDateTime 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,
java.sql.Timestamp x,
boolean forceEncrypt)
throws SQLServerException
ISQLServerPreparedStatementjava.sql.Timestamp valuesetSmallDateTime 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,
java.lang.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,
java.lang.String tvpName,
java.sql.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,
java.lang.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,
java.io.InputStream x,
int length)
throws java.sql.SQLException
setUnicodeStream in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void addBatch()
throws SQLServerException
addBatch in interface java.sql.PreparedStatementSQLServerExceptionpublic final void clearBatch()
throws SQLServerException
clearBatch in interface java.sql.StatementclearBatch in class SQLServerStatementSQLServerExceptionpublic int[] executeBatch()
throws SQLServerException,
java.sql.BatchUpdateException,
java.sql.SQLTimeoutException
SQLServerStatementexecuteBatch in interface java.sql.StatementexecuteBatch in class SQLServerStatementSQLServerExceptionjava.sql.BatchUpdateExceptionjava.sql.SQLTimeoutExceptionpublic long[] executeLargeBatch()
throws SQLServerException,
java.sql.BatchUpdateException,
java.sql.SQLTimeoutException
executeLargeBatch in interface java.sql.StatementexecuteLargeBatch in class SQLServerStatementSQLServerExceptionjava.sql.BatchUpdateExceptionjava.sql.SQLTimeoutExceptionpublic final void setCharacterStream(int parameterIndex,
java.io.Reader reader)
throws java.sql.SQLException
setCharacterStream in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setCharacterStream(int n,
java.io.Reader reader,
int length)
throws SQLServerException
setCharacterStream in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setCharacterStream(int parameterIndex,
java.io.Reader reader,
long length)
throws java.sql.SQLException
setCharacterStream in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setNCharacterStream(int parameterIndex,
java.io.Reader value)
throws java.sql.SQLException
setNCharacterStream in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setNCharacterStream(int parameterIndex,
java.io.Reader value,
long length)
throws java.sql.SQLException
setNCharacterStream in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setRef(int i,
java.sql.Ref x)
throws java.sql.SQLException
setRef in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setBlob(int i,
java.sql.Blob x)
throws java.sql.SQLException
setBlob in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setBlob(int parameterIndex,
java.io.InputStream inputStream)
throws java.sql.SQLException
setBlob in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setBlob(int parameterIndex,
java.io.InputStream inputStream,
long length)
throws java.sql.SQLException
setBlob in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setClob(int parameterIndex,
java.sql.Clob clobValue)
throws java.sql.SQLException
setClob in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setClob(int parameterIndex,
java.io.Reader reader)
throws java.sql.SQLException
setClob in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setClob(int parameterIndex,
java.io.Reader reader,
long length)
throws java.sql.SQLException
setClob in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setNClob(int parameterIndex,
java.sql.NClob value)
throws java.sql.SQLException
setNClob in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setNClob(int parameterIndex,
java.io.Reader reader)
throws java.sql.SQLException
setNClob in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setNClob(int parameterIndex,
java.io.Reader reader,
long length)
throws java.sql.SQLException
setNClob in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setArray(int i,
java.sql.Array x)
throws java.sql.SQLException
setArray in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setDate(int n,
java.sql.Date x,
java.util.Calendar cal)
throws SQLServerException
setDate in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setDate(int n,
java.sql.Date x,
java.util.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,
java.sql.Time x,
java.util.Calendar cal)
throws SQLServerException
setTime in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setTime(int n,
java.sql.Time x,
java.util.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,
java.sql.Timestamp x,
java.util.Calendar cal)
throws SQLServerException
setTimestamp in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setTimestamp(int n,
java.sql.Timestamp x,
java.util.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,
java.lang.String typeName)
throws SQLServerException
setNull in interface java.sql.PreparedStatementSQLServerExceptionpublic final java.sql.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 java.sql.ParameterMetaData getParameterMetaData()
throws SQLServerException
getParameterMetaData in interface java.sql.PreparedStatementSQLServerExceptionpublic final void setURL(int parameterIndex,
java.net.URL x)
throws java.sql.SQLException
setURL in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setRowId(int parameterIndex,
java.sql.RowId x)
throws java.sql.SQLException
setRowId in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final void setSQLXML(int parameterIndex,
java.sql.SQLXML xmlObject)
throws java.sql.SQLException
setSQLXML in interface java.sql.PreparedStatementjava.sql.SQLExceptionpublic final int executeUpdate(java.lang.String sql)
throws SQLServerException
executeUpdate in interface java.sql.StatementexecuteUpdate in class SQLServerStatementSQLServerExceptionpublic final boolean execute(java.lang.String sql)
throws SQLServerException
execute in interface java.sql.Statementexecute in class SQLServerStatementSQLServerExceptionpublic final java.sql.ResultSet executeQuery(java.lang.String sql)
throws SQLServerException
executeQuery in interface java.sql.StatementexecuteQuery in class SQLServerStatementSQLServerExceptionpublic void addBatch(java.lang.String sql)
throws SQLServerException
addBatch in interface java.sql.StatementaddBatch in class SQLServerStatementSQLServerExceptionCopyright © 2018 Microsoft Corporation. All rights reserved.