Class SQLServerConnection
- All Implemented Interfaces:
ISQLServerConnection
,Serializable
,AutoCloseable
,Connection
,Wrapper
- Direct Known Subclasses:
SQLServerConnection43
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
Fields inherited from interface com.microsoft.sqlserver.jdbc.ISQLServerConnection
TRANSACTION_SNAPSHOT
-
Method Summary
Modifier and TypeMethodDescriptionvoid
static void
Clears User token cache.void
void
close()
void
Forces the un-prepare requests for any outstanding discarded prepared statements to be executed.void
commit()
void
commit(boolean delayedDurability)
Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by thisConnection
object.createArrayOf(String typeName, Object[] elements)
createStatement(int resultSetType, int resultSetConcurrency)
createStatement(int nType, int nConcur, int resultSetHoldability)
createStatement(int nType, int nConcur, int resultSetHoldability, SQLServerStatementColumnEncryptionSetting stmtColEncSetting)
Creates aStatement
object that will generateResultSet
objects with the given type, concurrency, and holdability.createStruct(String typeName, Object[] attributes)
boolean
Returns the connection ID of the most recent connection attempt, regardless of whether the attempt succeeded or failed.getClientInfo(String name)
Returns the Trusted Master Key Paths.boolean
Returns the current flag value for delayLoadingLobs.boolean
Returns the value whether statement pooling is disabled.int
Returns the number of currently outstanding prepared statement un-prepare actions.boolean
Returns the behavior for a specific connection instance.int
int
boolean
Returns the value of the sendTimeAsDatetime property.int
Returns the behavior for a specific connection instance.int
Returns the current number of pooled prepared statement handles.int
Returns the size of the prepared statement cache for this connection.int
boolean
Returns the useBulkCopyForBatchInsert value.boolean
Returns the current flag value for useFmtOnly.boolean
isClosed()
boolean
boolean
Returns whether statement pooling is enabled or not for this connection.boolean
isValid(int timeout)
Determine whether the connection is still valid.boolean
isWrapperFor(Class<?> iface)
protected boolean
Returns if Federated Authentication is in use or is about to expire soonprepareCall(String sql)
prepareCall(String sql, int resultSetType, int resultSetConcurrency)
prepareCall(String sql, int nType, int nConcur, int resultSetHoldability)
prepareCall(String sql, int nType, int nConcur, int resultSetHoldability, SQLServerStatementColumnEncryptionSetting stmtColEncSetiing)
Creates aCallableStatement
object that will generateResultSet
objects with the given type and concurrency.prepareStatement(String sql)
prepareStatement(String sql, int flag)
prepareStatement(String sql, int[] columnIndexes)
prepareStatement(String sql, int[] columnIndexes, SQLServerStatementColumnEncryptionSetting stmtColEncSetting)
Creates a defaultPreparedStatement
object capable of returning the auto-generated keys designated by the given array.prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
prepareStatement(String sql, int nType, int nConcur, int resultSetHoldability)
prepareStatement(String sql, int nType, int nConcur, int resultSetHoldability, SQLServerStatementColumnEncryptionSetting stmtColEncSetting)
Creates aPreparedStatement
object that will generateResultSet
objects with the given type, concurrency, and holdability.prepareStatement(String sql, int flag, SQLServerStatementColumnEncryptionSetting stmtColEncSetting)
Creates a defaultPreparedStatement
object that has the capability to retrieve auto-generated keys.prepareStatement(String sql, String[] columnNames)
prepareStatement(String sql, String[] columnNames, SQLServerStatementColumnEncryptionSetting stmtColEncSetting)
Creates a defaultPreparedStatement
object capable of returning the auto-generated keys designated by the given array.static void
registerColumnEncryptionKeyStoreProviders(Map<String,SQLServerColumnEncryptionKeyStoreProvider> clientKeyStoreProviders)
Registers key store providers in the globalCustomColumnEncryptionKeyStoreProviders.void
releaseSavepoint(Savepoint savepoint)
static void
Removes the trusted Master key Path from the columnEncryptionTrustedMasterKeyPaths.void
rollback()
void
void
setAutoCommit(boolean newAutoCommitMode)
void
setCatalog(String catalog)
void
setClientInfo(String name, String value)
void
setClientInfo(Properties properties)
static void
setColumnEncryptionKeyCacheTtl(int columnEncryptionKeyCacheTTL, TimeUnit unit)
Sets time-to-live for column encryption key entries in the column encryption key cache for the Always Encrypted feature.static void
setColumnEncryptionTrustedMasterKeyPaths(Map<String,List<String>> trustedKeyPaths)
Sets Trusted Master Key Paths in the columnEncryptionTrustedMasterKeyPaths.void
setDelayLoadingLobs(boolean b)
Specifies the flag to immediately load LOB objects into memory.void
setDisableStatementPooling(boolean value)
Sets the value to Disable/enable statement pooling.void
setEnablePrepareOnFirstPreparedStatementCall(boolean value)
Sets the behavior for a specific connection instance.void
setHoldability(int holdability)
void
setNetworkTimeout(Executor executor, int timeout)
void
setReadOnly(boolean readOnly)
setSavepoint(String sName)
void
void
setSendTimeAsDatetime(boolean sendTimeAsDateTimeValue)
Sets the value of the sendTimeAsDatetime connection property.void
setServerPreparedStatementDiscardThreshold(int value)
Sets the behavior for a specific connection instance.void
setStatementPoolingCacheSize(int value)
Sets the size of the prepared statement cache for this connection.void
setTransactionIsolation(int level)
void
setTypeMap(Map<String,Class<?>> map)
void
setUseBulkCopyForBatchInsert(boolean useBulkCopyForBatchInsert)
Specifies the flag for using Bulk Copy API for batch insert operations.void
setUseFmtOnly(boolean useFmtOnly)
Specifies the flag to use FMTONLY for parameter metadata queries.toString()
Provides a helper function to return an ID string suitable for tracing.static void
Unregisters all the custom key store providers from the globalCustomColumnEncryptionKeyStoreProviders by clearing the map and setting it to null.<T> T
static void
updateColumnEncryptionTrustedMasterKeyPaths(String server, List<String> trustedKeyPaths)
Updates the columnEncryptionTrustedMasterKeyPaths with the new Server and trustedKeyPaths.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
Method Details
-
getUseBulkCopyForBatchInsert
public boolean getUseBulkCopyForBatchInsert()Returns the useBulkCopyForBatchInsert value.- Returns:
- flag for using Bulk Copy API for batch insert operations.
-
setUseBulkCopyForBatchInsert
public void setUseBulkCopyForBatchInsert(boolean useBulkCopyForBatchInsert)Specifies the flag for using Bulk Copy API for batch insert operations.- Parameters:
useBulkCopyForBatchInsert
- boolean value for useBulkCopyForBatchInsert.
-
getSendTimeAsDatetime
public final boolean getSendTimeAsDatetime()Description copied from interface:ISQLServerConnection
Returns the value of the sendTimeAsDatetime property.- Specified by:
getSendTimeAsDatetime
in interfaceISQLServerConnection
- Returns:
- boolean value of sendTimeAsDatetime
-
getDelayLoadingLobs
public boolean getDelayLoadingLobs()Description copied from interface:ISQLServerConnection
Returns the current flag value for delayLoadingLobs.- Specified by:
getDelayLoadingLobs
in interfaceISQLServerConnection
- Returns:
- 'delayLoadingLobs' property value.
-
setDelayLoadingLobs
public void setDelayLoadingLobs(boolean b)Description copied from interface:ISQLServerConnection
Specifies the flag to immediately load LOB objects into memory.- Specified by:
setDelayLoadingLobs
in interfaceISQLServerConnection
- Parameters:
b
- boolean value for 'delayLoadingLobs'.
-
registerColumnEncryptionKeyStoreProviders
public static void registerColumnEncryptionKeyStoreProviders(Map<String,SQLServerColumnEncryptionKeyStoreProvider> clientKeyStoreProviders) throws SQLServerExceptionRegisters key store providers in the globalCustomColumnEncryptionKeyStoreProviders.- Parameters:
clientKeyStoreProviders
- a map containing the store providers information.- Throws:
SQLServerException
- when an error occurs
-
unregisterColumnEncryptionKeyStoreProviders
public static void unregisterColumnEncryptionKeyStoreProviders()Unregisters all the custom key store providers from the globalCustomColumnEncryptionKeyStoreProviders by clearing the map and setting it to null. -
setColumnEncryptionTrustedMasterKeyPaths
public static void setColumnEncryptionTrustedMasterKeyPaths(Map<String,List<String>> trustedKeyPaths)Sets Trusted Master Key Paths in the columnEncryptionTrustedMasterKeyPaths.- Parameters:
trustedKeyPaths
- all master key paths that are trusted
-
updateColumnEncryptionTrustedMasterKeyPaths
public static void updateColumnEncryptionTrustedMasterKeyPaths(String server, List<String> trustedKeyPaths)Updates the columnEncryptionTrustedMasterKeyPaths with the new Server and trustedKeyPaths.- Parameters:
server
- String server nametrustedKeyPaths
- all master key paths that are trusted
-
removeColumnEncryptionTrustedMasterKeyPaths
Removes the trusted Master key Path from the columnEncryptionTrustedMasterKeyPaths.- Parameters:
server
- String server name
-
getColumnEncryptionTrustedMasterKeyPaths
Returns the Trusted Master Key Paths.- Returns:
- columnEncryptionTrustedMasterKeyPaths.
-
clearUserTokenCache
public static void clearUserTokenCache()Clears User token cache. This will clear all account info so interactive login will be required on the next request to acquire an access token. -
getClientConnectionId
Description copied from interface:ISQLServerConnection
Returns the connection ID of the most recent connection attempt, regardless of whether the attempt succeeded or failed.- Specified by:
getClientConnectionId
in interfaceISQLServerConnection
- Returns:
- 16-byte GUID representing the connection ID of the most recent connection attempt. Or, NULL if there is a failure after the connection request is initiated and the pre-login handshake.
- Throws:
SQLServerException
- If any errors occur.
-
toString
Provides a helper function to return an ID string suitable for tracing. -
needsReconnect
protected boolean needsReconnect()Returns if Federated Authentication is in use or is about to expire soon- Returns:
- true/false
-
createStatement
- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLServerException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLServerException
-
prepareCall
- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLServerException
-
nativeSQL
- Specified by:
nativeSQL
in interfaceConnection
- Throws:
SQLServerException
-
setAutoCommit
- Specified by:
setAutoCommit
in interfaceConnection
- Throws:
SQLServerException
-
getAutoCommit
- Specified by:
getAutoCommit
in interfaceConnection
- Throws:
SQLServerException
-
commit
- Specified by:
commit
in interfaceConnection
- Throws:
SQLServerException
-
commit
Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by thisConnection
object. This method should be used only when auto-commit mode has been disabled.- Parameters:
delayedDurability
- flag to indicate whether the commit will occur with delayed durability on.- Throws:
SQLServerException
- Exception if a database access error occurs
-
rollback
- Specified by:
rollback
in interfaceConnection
- Throws:
SQLServerException
-
abort
- Specified by:
abort
in interfaceConnection
- Throws:
SQLException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceConnection
- Throws:
SQLServerException
-
isClosed
- Specified by:
isClosed
in interfaceConnection
- Throws:
SQLServerException
-
getMetaData
- Specified by:
getMetaData
in interfaceConnection
- Throws:
SQLServerException
-
setReadOnly
- Specified by:
setReadOnly
in interfaceConnection
- Throws:
SQLServerException
-
isReadOnly
- Specified by:
isReadOnly
in interfaceConnection
- Throws:
SQLServerException
-
setCatalog
- Specified by:
setCatalog
in interfaceConnection
- Throws:
SQLServerException
-
getCatalog
- Specified by:
getCatalog
in interfaceConnection
- Throws:
SQLServerException
-
setTransactionIsolation
- Specified by:
setTransactionIsolation
in interfaceConnection
- Throws:
SQLServerException
-
getTransactionIsolation
- Specified by:
getTransactionIsolation
in interfaceConnection
- Throws:
SQLServerException
-
getWarnings
- Specified by:
getWarnings
in interfaceConnection
- Throws:
SQLServerException
-
clearWarnings
- Specified by:
clearWarnings
in interfaceConnection
- Throws:
SQLServerException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLServerException- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLServerException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLServerException- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLServerException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLServerException- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLServerException
-
setTypeMap
- Specified by:
setTypeMap
in interfaceConnection
- Throws:
SQLException
-
getTypeMap
- Specified by:
getTypeMap
in interfaceConnection
- Throws:
SQLServerException
-
createStatement
public Statement createStatement(int nType, int nConcur, int resultSetHoldability) throws SQLServerException- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLServerException
-
createStatement
public Statement createStatement(int nType, int nConcur, int resultSetHoldability, SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerExceptionDescription copied from interface:ISQLServerConnection
Creates aStatement
object that will generateResultSet
objects with the given type, concurrency, and holdability. This method is the same as thecreateStatement
method above, but it allows the default result set type, concurrency, and holdability to be overridden.- Specified by:
createStatement
in interfaceISQLServerConnection
- Parameters:
nType
- one of the followingResultSet
constants:ResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
nConcur
- one of the followingResultSet
constants:ResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
resultSetHoldability
- one of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
stmtColEncSetting
- Specifies how data will be sent and received when reading and writing encrypted columns.- Returns:
- a new
Statement
object that will generateResultSet
objects with the given type, concurrency, and holdability - Throws:
SQLServerException
- if a database access error occurs, this method is called on a closed connection or the given parameters are notResultSet
constants indicating type, concurrency, and holdability
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int nType, int nConcur, int resultSetHoldability) throws SQLServerException- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLServerException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int nType, int nConcur, int resultSetHoldability, SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerExceptionDescription copied from interface:ISQLServerConnection
Creates aPreparedStatement
object that will generateResultSet
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.- Specified by:
prepareStatement
in interfaceISQLServerConnection
- Parameters:
sql
- aString
object that is the SQL statement to be sent to the database; may contain one or more '?' IN parametersnType
- one of the followingResultSet
constants:ResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
nConcur
- one of the followingResultSet
constants:ResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
resultSetHoldability
- one of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
stmtColEncSetting
- Specifies how data will be sent and received when reading and writing encrypted columns.- Returns:
- a new
PreparedStatement
object, containing the pre-compiled SQL statement, that will generateResultSet
objects with the given type, concurrency, and holdability - Throws:
SQLServerException
- if a database access error occurs, this method is called on a closed connection or the given parameters are notResultSet
constants indicating type, concurrency, and holdability
-
prepareCall
public CallableStatement prepareCall(String sql, int nType, int nConcur, int resultSetHoldability) throws SQLServerException- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLServerException
-
prepareCall
public CallableStatement prepareCall(String sql, int nType, int nConcur, int resultSetHoldability, SQLServerStatementColumnEncryptionSetting stmtColEncSetiing) throws SQLServerExceptionDescription copied from interface:ISQLServerConnection
Creates aCallableStatement
object that will generateResultSet
objects with the given type and concurrency. This method is the same as theprepareCall
method above, but it allows the default result set type, result set concurrency type and holdability to be overridden.- Specified by:
prepareCall
in interfaceISQLServerConnection
- Parameters:
sql
- aString
object that is the SQL statement to be sent to the database; may contain on or more '?' parametersnType
- one of the followingResultSet
constants:ResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
nConcur
- one of the followingResultSet
constants:ResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
resultSetHoldability
- one of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
stmtColEncSetiing
- Specifies how data will be sent and received when reading and writing encrypted columns.- Returns:
- a new
CallableStatement
object, containing the pre-compiled SQL statement, that will generateResultSet
objects with the given type, concurrency, and holdability - Throws:
SQLServerException
- if a database access error occurs, this method is called on a closed connection or the given parameters are notResultSet
constants indicating type, concurrency, and holdability
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLServerException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int flag, SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerExceptionDescription copied from interface:ISQLServerConnection
Creates a defaultPreparedStatement
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 anINSERT
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 thePreparedStatement
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 typeTYPE_FORWARD_ONLY
and have a concurrency level ofCONCUR_READ_ONLY
. The holdability of the created result sets can be determined by callingConnection.getHoldability()
.- Specified by:
prepareStatement
in interfaceISQLServerConnection
- Parameters:
sql
- an SQL statement that may contain one or more '?' IN parameter placeholdersflag
- a flag indicating whether auto-generated keys should be returned; one ofStatement.RETURN_GENERATED_KEYS
orStatement.NO_GENERATED_KEYS
stmtColEncSetting
- Specifies how data will be sent and received when reading and writing encrypted columns.- Returns:
- a new
PreparedStatement
object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys - Throws:
SQLServerException
- if a database access error occurs, this method is called on a closed connection or the given parameter is not aStatement
constant indicating whether auto-generated keys should be returned
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLServerException- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLServerException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int[] columnIndexes, SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerExceptionDescription copied from interface:ISQLServerConnection
Creates a defaultPreparedStatement
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 anINSERT
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 thePreparedStatement
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 typeTYPE_FORWARD_ONLY
and have a concurrency level ofCONCUR_READ_ONLY
. The holdability of the created result sets can be determined by callingConnection.getHoldability()
.- Specified by:
prepareStatement
in interfaceISQLServerConnection
- Parameters:
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.- Returns:
- a new
PreparedStatement
object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column indexes - Throws:
SQLServerException
- if a database access error occurs or this method is called on a closed connection
-
prepareStatement
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLServerException- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLServerException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, String[] columnNames, SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerExceptionDescription copied from interface:ISQLServerConnection
Creates a defaultPreparedStatement
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 anINSERT
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 thePreparedStatement
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 typeTYPE_FORWARD_ONLY
and have a concurrency level ofCONCUR_READ_ONLY
. The holdability of the created result sets can be determined by callingConnection.getHoldability()
.- Specified by:
prepareStatement
in interfaceISQLServerConnection
- Parameters:
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.- Returns:
- a new
PreparedStatement
object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column names - Throws:
SQLServerException
- if a database access error occurs or this method is called on a closed connection
-
releaseSavepoint
- Specified by:
releaseSavepoint
in interfaceConnection
- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepoint
in interfaceConnection
- Throws:
SQLServerException
-
setSavepoint
- Specified by:
setSavepoint
in interfaceConnection
- Throws:
SQLServerException
-
rollback
- Specified by:
rollback
in interfaceConnection
- Throws:
SQLServerException
-
getHoldability
- Specified by:
getHoldability
in interfaceConnection
- Throws:
SQLServerException
-
setHoldability
- Specified by:
setHoldability
in interfaceConnection
- Throws:
SQLServerException
-
getNetworkTimeout
- Specified by:
getNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-
getSchema
- Specified by:
getSchema
in interfaceConnection
- Throws:
SQLException
-
setSchema
- Specified by:
setSchema
in interfaceConnection
- Throws:
SQLException
-
setSendTimeAsDatetime
public void setSendTimeAsDatetime(boolean sendTimeAsDateTimeValue)Description copied from interface:ISQLServerConnection
Sets the value of the sendTimeAsDatetime connection property. When true, java.sql.Time values will be sent to the server as SQL Serverdatetime values. When false, java.sql.Time values will be sent to the server as SQL Servertime values. sendTimeAsDatetime can also be modified programmatically with SQLServerDataSource.setSendTimeAsDatetime. The default value for this property may change in a future release.- Specified by:
setSendTimeAsDatetime
in interfaceISQLServerConnection
- Parameters:
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.
-
setUseFmtOnly
public void setUseFmtOnly(boolean useFmtOnly)Description copied from interface:ISQLServerConnection
Specifies the flag to use FMTONLY for parameter metadata queries.- Specified by:
setUseFmtOnly
in interfaceISQLServerConnection
- Parameters:
useFmtOnly
- boolean value for 'useFmtOnly'.
-
getUseFmtOnly
public final boolean getUseFmtOnly()Description copied from interface:ISQLServerConnection
Returns the current flag value for useFmtOnly.- Specified by:
getUseFmtOnly
in interfaceISQLServerConnection
- Returns:
- 'useFmtOnly' property value.
-
createArrayOf
- Specified by:
createArrayOf
in interfaceConnection
- Throws:
SQLException
-
createBlob
- Specified by:
createBlob
in interfaceConnection
- Throws:
SQLException
-
createClob
- Specified by:
createClob
in interfaceConnection
- Throws:
SQLException
-
createNClob
- Specified by:
createNClob
in interfaceConnection
- Throws:
SQLException
-
createSQLXML
- Specified by:
createSQLXML
in interfaceConnection
- Throws:
SQLException
-
createStruct
- Specified by:
createStruct
in interfaceConnection
- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Throws:
SQLClientInfoException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Throws:
SQLClientInfoException
-
isValid
Determine whether the connection is still valid. The driver shall submit a query on the connection or use some other mechanism that positively verifies the connection is still valid when this method is called. The query submitted by the driver to validate the connection shall be executed in the context of the current transaction.- Specified by:
isValid
in interfaceConnection
- Parameters:
timeout
- The time in seconds to wait for the database operation used to validate the connection to complete. If the timeout period expires before the operation completes, this method returns false. A value of 0 indicates a timeout is not applied to the database operation. Note that if the value is 0, the call to isValid may block indefinitely if the connection is not valid...- Returns:
- true if the connection has not been closed and is still valid.
- Throws:
SQLException
- if the value supplied for the timeout is less than 0.
-
isWrapperFor
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
unwrap
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
setColumnEncryptionKeyCacheTtl
public static void setColumnEncryptionKeyCacheTtl(int columnEncryptionKeyCacheTTL, TimeUnit unit) throws SQLServerExceptionSets time-to-live for column encryption key entries in the column encryption key cache for the Always Encrypted feature. The default value is 2 hours. This variable holds the value in seconds.- Parameters:
columnEncryptionKeyCacheTTL
- The timeunit in secondsunit
- The Timeunit.- Throws:
SQLServerException
- when an error occurs
-
getDiscardedServerPreparedStatementCount
public int getDiscardedServerPreparedStatementCount()Description copied from interface:ISQLServerConnection
Returns the number of currently outstanding prepared statement un-prepare actions.- Specified by:
getDiscardedServerPreparedStatementCount
in interfaceISQLServerConnection
- Returns:
- Returns the current value per the description.
-
closeUnreferencedPreparedStatementHandles
public void closeUnreferencedPreparedStatementHandles()Description copied from interface:ISQLServerConnection
Forces the un-prepare requests for any outstanding discarded prepared statements to be executed.- Specified by:
closeUnreferencedPreparedStatementHandles
in interfaceISQLServerConnection
-
getEnablePrepareOnFirstPreparedStatementCall
public boolean getEnablePrepareOnFirstPreparedStatementCall()Description copied from interface:ISQLServerConnection
Returns the behavior for a specific connection instance. If false the first execution will call sp_executesql and not prepare a statement, once the second execution happens it will call sp_prepexec and actually setup a prepared statement handle. Following executions will call sp_execute. This relieves the need for sp_unprepare on prepared statement close if the statement is only executed once. The default for this option can be changed by calling setDefaultEnablePrepareOnFirstPreparedStatementCall().- Specified by:
getEnablePrepareOnFirstPreparedStatementCall
in interfaceISQLServerConnection
- Returns:
- Returns the current setting per the description.
-
setEnablePrepareOnFirstPreparedStatementCall
public void setEnablePrepareOnFirstPreparedStatementCall(boolean value)Description copied from interface:ISQLServerConnection
Sets the behavior for a specific connection instance. If value is false the first execution will call sp_executesql and not prepare a statement, once the second execution happens it will call sp_prepexec and actually setup a prepared statement handle. Following executions will call sp_execute. This relieves the need for sp_unprepare on prepared statement close if the statement is only executed once.- Specified by:
setEnablePrepareOnFirstPreparedStatementCall
in interfaceISQLServerConnection
- Parameters:
value
- Changes the setting per the description.
-
getServerPreparedStatementDiscardThreshold
public int getServerPreparedStatementDiscardThreshold()Description copied from interface:ISQLServerConnection
Returns the behavior for a specific connection instance. This setting controls how many outstanding prepared statement discard actions (sp_unprepare) can be outstanding per connection before a call to clean-up the outstanding handles on the server is executed. If the setting is <= 1, unprepare actions will be executed immedietely on prepared statement close. If it is set to > 1, these calls will be batched together to avoid overhead of calling sp_unprepare too often. The default for this option can be changed by calling getDefaultServerPreparedStatementDiscardThreshold().- Specified by:
getServerPreparedStatementDiscardThreshold
in interfaceISQLServerConnection
- Returns:
- Returns the current setting per the description.
-
setServerPreparedStatementDiscardThreshold
public void setServerPreparedStatementDiscardThreshold(int value)Description copied from interface:ISQLServerConnection
Sets the behavior for a specific connection instance. This setting controls how many outstanding prepared statement discard actions (sp_unprepare) can be outstanding per connection before a call to clean-up the outstanding handles on the server is executed. If the setting is <= 1 unprepare actions will be executed immedietely on prepared statement close. If it is set to > 1 these calls will be batched together to avoid overhead of calling sp_unprepare too often.- Specified by:
setServerPreparedStatementDiscardThreshold
in interfaceISQLServerConnection
- Parameters:
value
- Changes the setting per the description.
-
getDisableStatementPooling
public boolean getDisableStatementPooling()Description copied from interface:ISQLServerConnection
Returns the value whether statement pooling is disabled.- Specified by:
getDisableStatementPooling
in interfaceISQLServerConnection
- Returns:
- true if statement pooling is disabled, false if it is enabled.
-
setDisableStatementPooling
public void setDisableStatementPooling(boolean value)Description copied from interface:ISQLServerConnection
Sets the value to Disable/enable statement pooling.- Specified by:
setDisableStatementPooling
in interfaceISQLServerConnection
- Parameters:
value
- true to disable statement pooling, false to enable it.
-
getStatementPoolingCacheSize
public int getStatementPoolingCacheSize()Description copied from interface:ISQLServerConnection
Returns the size of the prepared statement cache for this connection. A value less than 1 means no cache.- Specified by:
getStatementPoolingCacheSize
in interfaceISQLServerConnection
- Returns:
- Returns the current setting per the description.
-
getStatementHandleCacheEntryCount
public int getStatementHandleCacheEntryCount()Description copied from interface:ISQLServerConnection
Returns the current number of pooled prepared statement handles.- Specified by:
getStatementHandleCacheEntryCount
in interfaceISQLServerConnection
- Returns:
- Returns the current setting per the description.
-
isStatementPoolingEnabled
public boolean isStatementPoolingEnabled()Description copied from interface:ISQLServerConnection
Returns whether statement pooling is enabled or not for this connection.- Specified by:
isStatementPoolingEnabled
in interfaceISQLServerConnection
- Returns:
- Returns the current setting per the description.
-
setStatementPoolingCacheSize
public void setStatementPoolingCacheSize(int value)Description copied from interface:ISQLServerConnection
Sets the size of the prepared statement cache for this connection. A value less than 1 means no cache.- Specified by:
setStatementPoolingCacheSize
in interfaceISQLServerConnection
- Parameters:
value
- The new cache size.
-