AutoCloseable
, Connection
, Wrapper
ISQLServerConnection43
SQLServerConnection
, SQLServerConnection43
public interface ISQLServerConnection extends Connection
SQLServerConnection
and SQLServerConnectionPoolProxy
Classes.Modifier and Type | Field | Description |
---|---|---|
static int |
TRANSACTION_SNAPSHOT |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
Modifier and Type | Method | Description |
---|---|---|
void |
closeUnreferencedPreparedStatementHandles() |
Forces the un-prepare requests for any outstanding discarded prepared statements to be executed.
|
Statement |
createStatement(int nType,
int nConcur,
int nHold,
SQLServerStatementColumnEncryptionSetting stmtColEncSetting) |
Creates a
Statement object that will generate ResultSet objects with the given type, concurrency, and holdability. |
UUID |
getClientConnectionId() |
Gets the connection ID of the most recent connection attempt, regardless of whether the attempt succeeded or failed.
|
boolean |
getDisableStatementPooling() |
Determine whether statement pooling is disabled.
|
int |
getDiscardedServerPreparedStatementCount() |
Returns the number of currently outstanding prepared statement un-prepare actions.
|
boolean |
getEnablePrepareOnFirstPreparedStatementCall() |
Returns the behavior for a specific connection instance.
|
boolean |
getSendTimeAsDatetime() |
Checks the sendTimeAsDatetime property.
|
int |
getServerPreparedStatementDiscardThreshold() |
Returns the behavior for a specific connection instance.
|
int |
getStatementHandleCacheEntryCount() |
Returns the current number of pooled prepared statement handles.
|
int |
getStatementPoolingCacheSize() |
Returns the size of the prepared statement cache for this connection.
|
boolean |
isStatementPoolingEnabled() |
Whether statement pooling is enabled or not for this connection.
|
CallableStatement |
prepareCall(String sql,
int nType,
int nConcur,
int nHold,
SQLServerStatementColumnEncryptionSetting stmtColEncSetting) |
Creates a
CallableStatement object that will generate ResultSet objects with the given type and concurrency. |
PreparedStatement |
prepareStatement(String sql,
int[] columnIndexes,
SQLServerStatementColumnEncryptionSetting stmtColEncSetting) |
Creates a default
PreparedStatement object capable of returning the auto-generated keys designated by the given array. |
PreparedStatement |
prepareStatement(String sql,
int nType,
int nConcur,
int resultSetHoldability,
SQLServerStatementColumnEncryptionSetting stmtColEncSetting) |
Creates a
PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and
holdability. |
PreparedStatement |
prepareStatement(String sql,
int flag,
SQLServerStatementColumnEncryptionSetting stmtColEncSetting) |
Creates a default
PreparedStatement object that has the capability to retrieve auto-generated keys. |
PreparedStatement |
prepareStatement(String sql,
String[] columnNames,
SQLServerStatementColumnEncryptionSetting stmtColEncSetting) |
Creates a default
PreparedStatement object capable of returning the auto-generated keys designated by the given array. |
void |
setDisableStatementPooling(boolean value) |
Disable/enable statement pooling.
|
void |
setEnablePrepareOnFirstPreparedStatementCall(boolean value) |
Specifies the behavior for a specific connection instance.
|
void |
setSendTimeAsDatetime(boolean sendTimeAsDateTimeValue) |
Modifies the setting of the sendTimeAsDatetime connection property.
|
void |
setServerPreparedStatementDiscardThreshold(int value) |
Specifies the behavior for a specific connection instance.
|
void |
setStatementPoolingCacheSize(int value) |
Specifies the size of the prepared statement cache for this connection.
|
abort, beginRequest, clearWarnings, close, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, endRequest, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid, setTransactionIsolation, setTypeMap
isWrapperFor, unwrap
static final int TRANSACTION_SNAPSHOT
UUID getClientConnectionId() throws SQLServerException
SQLServerException
- If any errors occur.Statement createStatement(int nType, int nConcur, int nHold, SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerException
Statement
object that will generate ResultSet
objects with the given type, concurrency, and holdability.
This method is the same as the createStatement
method above, but it allows the default result set type, concurrency, and
holdability to be overridden.nType
- one of the following ResultSet
constants: ResultSet.TYPE_FORWARD_ONLY
,
ResultSet.TYPE_SCROLL_INSENSITIVE
, or ResultSet.TYPE_SCROLL_SENSITIVE
nConcur
- one of the following ResultSet
constants: ResultSet.CONCUR_READ_ONLY
or
ResultSet.CONCUR_UPDATABLE
nHold
- one of the following ResultSet
constants: ResultSet.HOLD_CURSORS_OVER_COMMIT
or
ResultSet.CLOSE_CURSORS_AT_COMMIT
stmtColEncSetting
- Specifies how data will be sent and received when reading and writing encrypted columns.Statement
object that will generate ResultSet
objects with the given type, concurrency, and holdabilitySQLServerException
- if a database access error occurs, this method is called on a closed connection or the given parameters are not
ResultSet
constants indicating type, concurrency, and holdabilityPreparedStatement prepareStatement(String sql, int flag, SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerException
PreparedStatement
object that has the capability to retrieve auto-generated keys. The given constant tells the
driver whether it should make auto-generated keys available for retrieval. This parameter is ignored if the SQL statement is not an
INSERT
statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).
Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports
precompilation, the method prepareStatement
will send the statement to the database for precompilation. Some drivers may not
support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement
object is
executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.
Result sets created using the returned PreparedStatement
object will by default be type TYPE_FORWARD_ONLY
and have a
concurrency level of CONCUR_READ_ONLY
. The holdability of the created result sets can be determined by calling
Connection.getHoldability()
.
sql
- an SQL statement that may contain one or more '?' IN parameter placeholdersflag
- a flag indicating whether auto-generated keys should be returned; one of Statement.RETURN_GENERATED_KEYS
or
Statement.NO_GENERATED_KEYS
stmtColEncSetting
- Specifies how data will be sent and received when reading and writing encrypted columns.PreparedStatement
object, containing the pre-compiled SQL statement, that will have the capability of returning
auto-generated keysSQLServerException
- if a database access error occurs, this method is called on a closed connection or the given parameter is not a
Statement
constant indicating whether auto-generated keys should be returnedPreparedStatement prepareStatement(String sql, int[] columnIndexes, SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerException
PreparedStatement
object capable of returning the auto-generated keys designated by the given array. This array
contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. The driver will
ignore the array if the SQL statement is not an INSERT
statement, or an SQL statement able to return auto-generated keys (the list
of such statements is vendor-specific).
An SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement
object. This object can then
be used to efficiently execute this statement multiple times.
Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports
precompilation, the method prepareStatement
will send the statement to the database for precompilation. Some drivers may not
support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement
object is
executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.
Result sets created using the returned PreparedStatement
object will by default be type TYPE_FORWARD_ONLY
and have a
concurrency level of CONCUR_READ_ONLY
. The holdability of the created result sets can be determined by calling
Connection.getHoldability()
.
sql
- an SQL statement that may contain one or more '?' IN parameter placeholderscolumnIndexes
- an array of column indexes indicating the columns that should be returned from the inserted row or rowsstmtColEncSetting
- Specifies how data will be sent and received when reading and writing encrypted columns.PreparedStatement
object, containing the pre-compiled statement, that is capable of returning the auto-generated
keys designated by the given array of column indexesSQLServerException
- if a database access error occurs or this method is called on a closed connectionPreparedStatement prepareStatement(String sql, String[] columnNames, SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerException
PreparedStatement
object capable of returning the auto-generated keys designated by the given array. This array
contains the names of the columns in the target table that contain the auto-generated keys that should be returned. The driver will ignore the
array if the SQL statement is not an INSERT
statement, or an SQL statement able to return auto-generated keys (the list of such
statements is vendor-specific).
An SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement
object. This object can then
be used to efficiently execute this statement multiple times.
Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports
precompilation, the method prepareStatement
will send the statement to the database for precompilation. Some drivers may not
support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement
object is
executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.
Result sets created using the returned PreparedStatement
object will by default be type TYPE_FORWARD_ONLY
and have a
concurrency level of CONCUR_READ_ONLY
. The holdability of the created result sets can be determined by calling
Connection.getHoldability()
.
sql
- an SQL statement that may contain one or more '?' IN parameter placeholderscolumnNames
- an array of column names indicating the columns that should be returned from the inserted row or rowsstmtColEncSetting
- Specifies how data will be sent and received when reading and writing encrypted columns.PreparedStatement
object, containing the pre-compiled statement, that is capable of returning the auto-generated
keys designated by the given array of column namesSQLServerException
- if a database access error occurs or this method is called on a closed connectionPreparedStatement prepareStatement(String sql, int nType, int nConcur, int resultSetHoldability, SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerException
PreparedStatement
object that will generate ResultSet
objects with the given type, concurrency, and
holdability.
This method is the same as the prepareStatement
method above, but it allows the default result set type, concurrency, and
holdability to be overridden.
sql
- a String
object that is the SQL statement to be sent to the database; may contain one or more '?' IN parametersnType
- one of the following ResultSet
constants: ResultSet.TYPE_FORWARD_ONLY
,
ResultSet.TYPE_SCROLL_INSENSITIVE
, or ResultSet.TYPE_SCROLL_SENSITIVE
nConcur
- one of the following ResultSet
constants: ResultSet.CONCUR_READ_ONLY
or
ResultSet.CONCUR_UPDATABLE
resultSetHoldability
- one of the following ResultSet
constants: ResultSet.HOLD_CURSORS_OVER_COMMIT
or
ResultSet.CLOSE_CURSORS_AT_COMMIT
stmtColEncSetting
- Specifies how data will be sent and received when reading and writing encrypted columns.PreparedStatement
object, containing the pre-compiled SQL statement, that will generate ResultSet
objects with the given type, concurrency, and holdabilitySQLServerException
- if a database access error occurs, this method is called on a closed connection or the given parameters are not
ResultSet
constants indicating type, concurrency, and holdabilityCallableStatement prepareCall(String sql, int nType, int nConcur, int nHold, SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerException
CallableStatement
object that will generate ResultSet
objects with the given type and concurrency. This
method is the same as the prepareCall
method above, but it allows the default result set type, result set concurrency type and
holdability to be overridden.sql
- a String
object that is the SQL statement to be sent to the database; may contain on or more '?' parametersnType
- one of the following ResultSet
constants: ResultSet.TYPE_FORWARD_ONLY
,
ResultSet.TYPE_SCROLL_INSENSITIVE
, or ResultSet.TYPE_SCROLL_SENSITIVE
nConcur
- one of the following ResultSet
constants: ResultSet.CONCUR_READ_ONLY
or
ResultSet.CONCUR_UPDATABLE
nHold
- one of the following ResultSet
constants: ResultSet.HOLD_CURSORS_OVER_COMMIT
or
ResultSet.CLOSE_CURSORS_AT_COMMIT
stmtColEncSetting
- Specifies how data will be sent and received when reading and writing encrypted columns.CallableStatement
object, containing the pre-compiled SQL statement, that will generate ResultSet
objects with the given type, concurrency, and holdabilitySQLServerException
- if a database access error occurs, this method is called on a closed connection or the given parameters are not
ResultSet
constants indicating type, concurrency, and holdabilityvoid setSendTimeAsDatetime(boolean sendTimeAsDateTimeValue) throws SQLServerException
sendTimeAsDateTimeValue
- enables/disables setting the sendTimeAsDatetime connection property. For more information about how the Microsoft JDBC Driver for
SQL Server configures java.sql.Time values before sending them to the server, see
Configuring How java.sql.Time Values are Sent to the
Server.SQLServerException
- if a database access error occursboolean getSendTimeAsDatetime() throws SQLServerException
SQLServerException
- if a database access error occursint getDiscardedServerPreparedStatementCount()
void closeUnreferencedPreparedStatementHandles()
boolean getEnablePrepareOnFirstPreparedStatementCall()
void setEnablePrepareOnFirstPreparedStatementCall(boolean value)
value
- Changes the setting per the description.int getServerPreparedStatementDiscardThreshold()
void setServerPreparedStatementDiscardThreshold(int value)
value
- Changes the setting per the description.void setStatementPoolingCacheSize(int value)
value
- The new cache size.int getStatementPoolingCacheSize()
boolean isStatementPoolingEnabled()
int getStatementHandleCacheEntryCount()
void setDisableStatementPooling(boolean value)
value
- true to disable statement pooling, false to enable it.boolean getDisableStatementPooling()
Copyright © 2018 Microsoft Corporation. All rights reserved.