public class SQLServerDataSource extends Object implements ISQLServerDataSource, DataSource, Serializable, Referenceable
| Constructor and Description |
|---|
SQLServerDataSource()
Initializes a new instance of the SQLServerDataSource class.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAccessToken()
Retrieves the access token.
|
String |
getApplicationIntent()
Returns the application intent.
|
String |
getApplicationName()
Returns the application name.
|
String |
getAuthentication()
Retrieves the authentication mode
|
String |
getColumnEncryptionSetting()
Retrieves the Always Encrypted functionality setting for the data source object.
|
Connection |
getConnection() |
Connection |
getConnection(String username,
String password) |
String |
getDatabaseName()
Returns the database name.
|
String |
getDescription()
Returns a description of the data source.
|
boolean |
getEnablePrepareOnFirstPreparedStatementCall()
If this configuration returns false the first execution of a prepared statement 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.
|
boolean |
getEncrypt()
Returns a Boolean value that indicates if the encrypt property is enabled.
|
String |
getFailoverPartner()
Returns the name of the failover server that is used in a database mirroring configuration.
|
boolean |
getFIPS() |
String |
getFIPSProvider() |
GSSCredential |
getGSSCredentials()
Retrieves the GSSCredential
|
String |
getHostNameInCertificate()
Returns the host name used in validating the SQL Server Secure Sockets Layer (SSL) certificate.
|
String |
getInstanceName()
Returns the SQL Server instance name.
|
String |
getJASSConfigurationName()
Retrieves the login configuration file for Kerberos authentication.
|
String |
getKeyStoreAuthentication()
Gets the value of the keyStoreAuthentication setting for the data source object.
|
String |
getKeyStoreLocation()
Retrieves the keyStoreLocation for the Java Key Store.
|
boolean |
getLastUpdateCount()
Returns a Boolean value that indicates if the lastUpdateCount property is enabled.
|
int |
getLockTimeout()
Returns an int value that indicates the number of milliseconds that the database will wait before reporting a lock time out.
|
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
boolean |
getMultiSubnetFailover()
Returns the value of the multiSubnetFailover connection property.
|
int |
getPacketSize()
Returns the current network packet size used to communicate with SQL Server, specified in bytes.
|
Logger |
getParentLogger() |
int |
getPortNumber()
Returns the current port number that is used to communicate with SQL Server.
|
int |
getQueryTimeout()
Getting the query timeout
|
Reference |
getReference() |
String |
getResponseBuffering()
Returns the response buffering mode for this SQLServerDataSource object.
|
String |
getSelectMethod()
Returns the default cursor type used for all result sets that are created by using this SQLServerDataSource object.
|
boolean |
getSendStringParametersAsUnicode()
Returns a boolean value that indicates if sending string parameters to the server in UNICODE format is enabled.
|
boolean |
getSendTimeAsDatetime()
This method was added in SQL Server JDBC Driver 3.0.
|
String |
getServerName()
Returns the name of the SQL Server instance.
|
boolean |
getServerNameAsACE()
Retrieves if the serverName should be translated from Unicode to ASCII Compatible Encoding (ACE)
|
int |
getServerPreparedStatementDiscardThreshold()
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.
|
String |
getServerSpn()
Returns the server spn
|
int |
getSocketTimeout()
Getting the socket timeout
|
boolean |
getTransparentNetworkIPResolution()
Retrieves the TransparentNetworkIPResolution value.
|
boolean |
getTrustServerCertificate()
Returns a Boolean value that indicates if the trustServerCertificate property is enabled.
|
String |
getTrustStore()
Returns the path (including file name) to the certificate trustStore file.
|
String |
getTrustStoreType() |
String |
getURL()
Returns the URL that is used to connect to the data source.
|
String |
getUser()
Returns the user name that is used to connect the data source.
|
String |
getWorkstationID()
Returns the name of the client computer name that is used to connect to the data source.
|
boolean |
getXopenStates()
Returns a boolean value that indicates if converting SQL states to XOPEN compliant states is enabled.
|
boolean |
isWrapperFor(Class<?> iface) |
void |
setAccessToken(String accessToken)
Sets the access token.
|
void |
setApplicationIntent(String applicationIntent)
Sets the application intent.
|
void |
setApplicationName(String applicationName)
Sets the application name.
|
void |
setAuthentication(String authentication)
sets the authentication mode
|
void |
setAuthenticationScheme(String authenticationScheme)
Indicates the kind of integrated security you want your application to use.
|
void |
setColumnEncryptionSetting(String columnEncryptionSetting)
Enables/disables Always Encrypted functionality for the data source object.
|
void |
setDatabaseName(String databaseName)
Sets the database name to connect to.
|
void |
setDescription(String description)
Sets the description of the data source.
|
void |
setEnablePrepareOnFirstPreparedStatementCall(boolean enablePrepareOnFirstPreparedStatementCall)
If this configuration is false the first execution of a prepared statement 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.
|
void |
setEncrypt(boolean encrypt)
Sets a Boolean value that indicates if the encrypt property is enabled.
|
void |
setFailoverPartner(String serverName)
Sets the name of the failover server that is used in a database mirroring configuration.
|
void |
setFIPS(boolean fips) |
void |
setFIPSProvider(String fipsProvider) |
void |
setGSSCredentials(GSSCredential userCredential)
sets GSSCredential
|
void |
setHostNameInCertificate(String host)
Sets the host name to be used in validating the SQL Server Secure Sockets Layer (SSL) certificate.
|
void |
setInstanceName(String instanceName)
Sets the SQL Server instance name.
|
void |
setIntegratedSecurity(boolean enable)
Sets a Boolean value that indicates if the integratedSecurity property is enabled.
|
void |
setJASSConfigurationName(String configurationName)
Sets the login configuration file for Kerberos authentication.
|
void |
setKeyStoreAuthentication(String keyStoreAuthentication)
Sets the name that identifies a key store.
|
void |
setKeyStoreLocation(String keyStoreLocation)
Sets the location including the file name for the Java keystore.
|
void |
setKeyStoreSecret(String keyStoreSecret)
Sets the password for the Java keystore.
|
void |
setLastUpdateCount(boolean lastUpdateCount)
Sets a Boolean value that indicates if the lastUpdateCount property is enabled.
|
void |
setLockTimeout(int lockTimeout)
Sets an int value that indicates the number of milliseconds to wait before the database reports a lock time out.
|
void |
setLoginTimeout(int loginTimeout) |
void |
setLogWriter(PrintWriter out) |
void |
setMultiSubnetFailover(boolean multiSubnetFailover)
Sets the value of the multiSubnetFailover connection property.
|
void |
setPacketSize(int packetSize)
Sets the current network packet size used to communicate with SQL Server, specified in bytes.
|
void |
setPassword(String password)
Sets the password that will be used to connect to SQL Server.
|
void |
setPortNumber(int portNumber)
Sets the port number to be used to communicate with SQL Server.
|
void |
setQueryTimeout(int queryTimeout)
Setting the query timeout
|
void |
setResponseBuffering(String respo)
Sets the response buffering mode for connections created by using this SQLServerDataSource object.
|
void |
setSelectMethod(String selectMethod)
Sets the default cursor type that is used for all result sets that are created by using this SQLServerDataSource object.
|
void |
setSendStringParametersAsUnicode(boolean sendStringParametersAsUnicode)
Sets a boolean value that indicates if sending string parameters to the server in UNICODE format is enabled.
|
void |
setSendTimeAsDatetime(boolean sendTimeAsDatetime)
Modifies the setting of the sendTimeAsDatetime connection property.
|
void |
setServerName(String serverName)
Sets the name of the computer that is running SQL Server.
|
void |
setServerNameAsACE(boolean serverNameAsACE)
Translates the serverName from Unicode to ASCII Compatible Encoding (ACE)
|
void |
setServerPreparedStatementDiscardThreshold(int serverPreparedStatementDiscardThreshold)
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.
|
void |
setServerSpn(String serverSpn)
Sets the server spn
|
void |
setSocketTimeout(int socketTimeout)
Setting the socket timeout
|
void |
setTransparentNetworkIPResolution(boolean tnir)
Beginning in version 6.0 of the Microsoft JDBC Driver for SQL Server, a new connection property transparentNetworkIPResolution (TNIR) is added
for transparent connection to Always On availability groups or to a server which has multiple IP addresses associated.
|
void |
setTrustServerCertificate(boolean e)
Sets a Boolean value that indicates if the trustServerCertificate property is enabled.
|
void |
setTrustStore(String st)
Sets the path (including file name) to the certificate trustStore file.
|
void |
setTrustStorePassword(String p)
Sets the password that is used to check the integrity of the trustStore data.
|
void |
setTrustStoreType(String trustStoreType) |
void |
setURL(String url)
Sets the URL that is used to connect to the data source.
|
void |
setUser(String user)
Sets the user name that is used to connect the data source.
|
void |
setWorkstationID(String workstationID)
Sets the name of the client computer name that is used to connect to the data source.
|
void |
setXopenStates(boolean xopenStates)
Sets a Boolean value that indicates if converting SQL states to XOPEN compliant states is enabled.
|
String |
toString() |
<T> T |
unwrap(Class<T> iface) |
public SQLServerDataSource()
public Connection getConnection() throws SQLServerException
getConnection in interface DataSourceSQLServerExceptionpublic Connection getConnection(String username, String password) throws SQLServerException
getConnection in interface DataSourceSQLServerExceptionpublic void setLoginTimeout(int loginTimeout)
setLoginTimeout in interface CommonDataSourcepublic int getLoginTimeout()
getLoginTimeout in interface CommonDataSourcepublic void setLogWriter(PrintWriter out)
setLogWriter in interface CommonDataSourcepublic PrintWriter getLogWriter()
getLogWriter in interface CommonDataSourcepublic Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger in interface CommonDataSourceSQLFeatureNotSupportedExceptionpublic void setApplicationName(String applicationName)
ISQLServerDataSourcesetApplicationName in interface ISQLServerDataSourceapplicationName - A String that contains the name of the application.public String getApplicationName()
ISQLServerDataSourcegetApplicationName in interface ISQLServerDataSourcepublic void setDatabaseName(String databaseName)
ISQLServerDataSourcesetDatabaseName in interface ISQLServerDataSourcedatabaseName - A String that contains the database name.public String getDatabaseName()
ISQLServerDataSourcegetDatabaseName in interface ISQLServerDataSourcepublic void setInstanceName(String instanceName)
ISQLServerDataSourcesetInstanceName in interface ISQLServerDataSourceinstanceName - A String that contains the instance name.public String getInstanceName()
ISQLServerDataSourcegetInstanceName in interface ISQLServerDataSourcepublic void setIntegratedSecurity(boolean enable)
ISQLServerDataSourcesetIntegratedSecurity in interface ISQLServerDataSourceenable - true if integratedSecurity is enabled. Otherwise, false.public void setAuthenticationScheme(String authenticationScheme)
ISQLServerDataSourcesetAuthenticationScheme in interface ISQLServerDataSourceauthenticationScheme - Values are "JavaKerberos" and the default "NativeAuthentication".public void setAuthentication(String authentication)
authentication - the authentication modepublic String getAuthentication()
public void setGSSCredentials(GSSCredential userCredential)
userCredential - the credentialpublic GSSCredential getGSSCredentials()
public void setAccessToken(String accessToken)
accessToken - to be set in the string property.public String getAccessToken()
public void setColumnEncryptionSetting(String columnEncryptionSetting)
columnEncryptionSetting - Enables/disables Always Encrypted functionality for the data source object. The default is Disabled.public String getColumnEncryptionSetting()
public void setKeyStoreAuthentication(String keyStoreAuthentication)
keyStoreAuthentication - the name that identifies a key store.public String getKeyStoreAuthentication()
public void setKeyStoreSecret(String keyStoreSecret)
keyStoreSecret - the password to use for the keystore as well as for the keypublic void setKeyStoreLocation(String keyStoreLocation)
keyStoreLocation - the location including the file name for the Java keystore.public String getKeyStoreLocation()
public void setLastUpdateCount(boolean lastUpdateCount)
ISQLServerDataSourcesetLastUpdateCount in interface ISQLServerDataSourcelastUpdateCount - true if lastUpdateCount is enabled. Otherwise, false.public boolean getLastUpdateCount()
ISQLServerDataSourcegetLastUpdateCount in interface ISQLServerDataSourcepublic void setEncrypt(boolean encrypt)
ISQLServerDataSourcesetEncrypt in interface ISQLServerDataSourceencrypt - true if the Secure Sockets Layer (SSL) encryption is enabled between the client and the SQL Server. Otherwise, false.public boolean getEncrypt()
ISQLServerDataSourcegetEncrypt in interface ISQLServerDataSourcepublic void setTransparentNetworkIPResolution(boolean tnir)
transparentNetworkIPResolution is ignored if multiSubnetFailover is true
transparentNetworkIPResolution is ignored if database mirroring is used
transparentNetworkIPResolution is ignored if there are more than 64 IP addresses
tnir - if set to true, the driver attempts to connect to the first IP address available. It is true by default.public boolean getTransparentNetworkIPResolution()
public void setTrustServerCertificate(boolean e)
ISQLServerDataSourcesetTrustServerCertificate in interface ISQLServerDataSourcee - true if the server Secure Sockets Layer (SSL) certificate should be automatically trusted when the communication layer is encrypted
using SSL. Otherwise, false.public boolean getTrustServerCertificate()
ISQLServerDataSourcegetTrustServerCertificate in interface ISQLServerDataSourcepublic void setTrustStoreType(String trustStoreType)
public String getTrustStoreType()
public void setTrustStore(String st)
ISQLServerDataSourcesetTrustStore in interface ISQLServerDataSourcest - A String that contains the path (including file name) to the certificate trustStore file.public String getTrustStore()
ISQLServerDataSourcegetTrustStore in interface ISQLServerDataSourcepublic void setTrustStorePassword(String p)
ISQLServerDataSourcesetTrustStorePassword in interface ISQLServerDataSourcep - A String that contains the password that is used to check the integrity of the trustStore data.public void setHostNameInCertificate(String host)
ISQLServerDataSourcesetHostNameInCertificate in interface ISQLServerDataSourcehost - A String that contains the host name.public String getHostNameInCertificate()
ISQLServerDataSourcegetHostNameInCertificate in interface ISQLServerDataSourcepublic void setLockTimeout(int lockTimeout)
ISQLServerDataSourcesetLockTimeout in interface ISQLServerDataSourcelockTimeout - An int value that contains the number of milliseconds to wait.public int getLockTimeout()
ISQLServerDataSourcegetLockTimeout in interface ISQLServerDataSourcepublic void setPassword(String password)
ISQLServerDataSourcesetPassword in interface ISQLServerDataSourcepassword - A String that contains the password.public void setPortNumber(int portNumber)
ISQLServerDataSourcesetPortNumber in interface ISQLServerDataSourceportNumber - An int value that contains the port number.public int getPortNumber()
ISQLServerDataSourcegetPortNumber in interface ISQLServerDataSourcepublic void setSelectMethod(String selectMethod)
ISQLServerDataSourcesetSelectMethod in interface ISQLServerDataSourceselectMethod - A String value that contains the default cursor type.public String getSelectMethod()
ISQLServerDataSourcegetSelectMethod in interface ISQLServerDataSourcepublic void setResponseBuffering(String respo)
ISQLServerDataSourcesetResponseBuffering in interface ISQLServerDataSourcerespo - A String that contains the buffering and streaming mode. The valid mode can be one of the following case-insensitive Strings: full
or adaptive.public String getResponseBuffering()
ISQLServerDataSourcegetResponseBuffering in interface ISQLServerDataSourcepublic void setApplicationIntent(String applicationIntent)
ISQLServerDataSourcesetApplicationIntent in interface ISQLServerDataSourceapplicationIntent - A String that contains the application intent.public String getApplicationIntent()
ISQLServerDataSourcegetApplicationIntent in interface ISQLServerDataSourcepublic void setSendTimeAsDatetime(boolean sendTimeAsDatetime)
ISQLServerDataSourcesetSendTimeAsDatetime in interface ISQLServerDataSourcesendTimeAsDatetime - A Boolean value. When true, causes java.sql.Time values to be sent to the server as SQL Server datetime types. When false, causes
java.sql.Time values to be sent to the server as SQL Server time types.public boolean getSendTimeAsDatetime()
ISQLServerDataSourcegetSendTimeAsDatetime in interface ISQLServerDataSourcepublic void setSendStringParametersAsUnicode(boolean sendStringParametersAsUnicode)
ISQLServerDataSourcesetSendStringParametersAsUnicode in interface ISQLServerDataSourcesendStringParametersAsUnicode - true if string parameters are sent to the server in UNICODE format. Otherwise, false.public boolean getSendStringParametersAsUnicode()
ISQLServerDataSourcegetSendStringParametersAsUnicode in interface ISQLServerDataSourcepublic void setServerNameAsACE(boolean serverNameAsACE)
serverNameAsACE - if enabled the servername will be translated to ASCII Compatible Encoding (ACE)public boolean getServerNameAsACE()
public void setServerName(String serverName)
ISQLServerDataSourcesetServerName in interface ISQLServerDataSourceserverName - A String that contains the server name.public String getServerName()
ISQLServerDataSourcegetServerName in interface ISQLServerDataSourcepublic void setServerSpn(String serverSpn)
ISQLServerDataSourcesetServerSpn in interface ISQLServerDataSourceserverSpn - A String that contains the server spnpublic String getServerSpn()
ISQLServerDataSourcegetServerSpn in interface ISQLServerDataSourcepublic void setFailoverPartner(String serverName)
ISQLServerDataSourcesetFailoverPartner in interface ISQLServerDataSourceserverName - A String that contains the failover server name.public String getFailoverPartner()
ISQLServerDataSourcegetFailoverPartner in interface ISQLServerDataSourcepublic void setMultiSubnetFailover(boolean multiSubnetFailover)
ISQLServerDataSourcesetMultiSubnetFailover in interface ISQLServerDataSourcemultiSubnetFailover - The new value of the multiSubnetFailover connection property.public boolean getMultiSubnetFailover()
ISQLServerDataSourcegetMultiSubnetFailover in interface ISQLServerDataSourcepublic void setUser(String user)
ISQLServerDataSourcesetUser in interface ISQLServerDataSourceuser - A String that contains the user name.public String getUser()
ISQLServerDataSourcegetUser in interface ISQLServerDataSourcepublic void setWorkstationID(String workstationID)
ISQLServerDataSourcesetWorkstationID in interface ISQLServerDataSourceworkstationID - A String that contains the client computer name.public String getWorkstationID()
ISQLServerDataSourcegetWorkstationID in interface ISQLServerDataSourcepublic void setXopenStates(boolean xopenStates)
ISQLServerDataSourcesetXopenStates in interface ISQLServerDataSourcexopenStates - true if converting SQL states to XOPEN compliant states is enabled. Otherwise, false.public boolean getXopenStates()
ISQLServerDataSourcegetXopenStates in interface ISQLServerDataSourcepublic void setFIPS(boolean fips)
public boolean getFIPS()
public void setFIPSProvider(String fipsProvider)
public String getFIPSProvider()
public void setURL(String url)
ISQLServerDataSourcesetURL in interface ISQLServerDataSourceurl - A String that contains the URL.public String getURL()
ISQLServerDataSourcegetURL in interface ISQLServerDataSourcepublic void setDescription(String description)
ISQLServerDataSourcesetDescription in interface ISQLServerDataSourcedescription - A String that contains the description.public String getDescription()
ISQLServerDataSourcegetDescription in interface ISQLServerDataSourcepublic void setPacketSize(int packetSize)
ISQLServerDataSourcesetPacketSize in interface ISQLServerDataSourcepacketSize - An int value containing the network packet size.public int getPacketSize()
ISQLServerDataSourcegetPacketSize in interface ISQLServerDataSourcepublic void setQueryTimeout(int queryTimeout)
queryTimeout - The number of seconds to wait before a timeout has occurred on a query. The default value is 0, which means infinite timeout.public int getQueryTimeout()
public void setEnablePrepareOnFirstPreparedStatementCall(boolean enablePrepareOnFirstPreparedStatementCall)
enablePrepareOnFirstPreparedStatementCall - Changes the setting per the description.public boolean getEnablePrepareOnFirstPreparedStatementCall()
public void setServerPreparedStatementDiscardThreshold(int serverPreparedStatementDiscardThreshold)
serverPreparedStatementDiscardThreshold - Changes the setting per the description.public int getServerPreparedStatementDiscardThreshold()
public void setSocketTimeout(int socketTimeout)
socketTimeout - The number of milliseconds to wait before a timeout is occurred on a socket read or accept. The default value is 0, which means
infinite timeout.public int getSocketTimeout()
public void setJASSConfigurationName(String configurationName)
configurationName - the configuration namepublic String getJASSConfigurationName()
public Reference getReference()
getReference in interface Referenceablepublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor in interface WrapperSQLExceptionpublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap in interface WrapperSQLExceptionCopyright © 2017 Microsoft Corporation. All rights reserved.