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 |
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.
|
String |
getFIPSProvider() |
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 |
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() |
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)
|
String |
getServerSpn()
Returns the server spn
|
int |
getSocketTimeout() |
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 |
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 |
setFIPSProvider(String fipsProvider) |
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 |
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) |
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 |
setServerSpn(String serverSpn)
Sets the server spn
|
void |
setSocketTimeout(int socketTimeout) |
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 DataSource
SQLServerException
public Connection getConnection(String username, String password) throws SQLServerException
getConnection
in interface DataSource
SQLServerException
public void setLoginTimeout(int loginTimeout)
setLoginTimeout
in interface CommonDataSource
public int getLoginTimeout()
getLoginTimeout
in interface CommonDataSource
public void setLogWriter(PrintWriter out)
setLogWriter
in interface CommonDataSource
public PrintWriter getLogWriter()
getLogWriter
in interface CommonDataSource
public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger
in interface CommonDataSource
SQLFeatureNotSupportedException
public void setApplicationName(String applicationName)
ISQLServerDataSource
setApplicationName
in interface ISQLServerDataSource
applicationName
- A String that contains the name of the application.public String getApplicationName()
ISQLServerDataSource
getApplicationName
in interface ISQLServerDataSource
public void setDatabaseName(String databaseName)
ISQLServerDataSource
setDatabaseName
in interface ISQLServerDataSource
databaseName
- A String that contains the database name.public String getDatabaseName()
ISQLServerDataSource
getDatabaseName
in interface ISQLServerDataSource
public void setInstanceName(String instanceName)
ISQLServerDataSource
setInstanceName
in interface ISQLServerDataSource
instanceName
- A String that contains the instance name.public String getInstanceName()
ISQLServerDataSource
getInstanceName
in interface ISQLServerDataSource
public void setIntegratedSecurity(boolean enable)
ISQLServerDataSource
setIntegratedSecurity
in interface ISQLServerDataSource
enable
- true if integratedSecurity is enabled. Otherwise, false.public void setAuthenticationScheme(String authenticationScheme)
ISQLServerDataSource
setAuthenticationScheme
in interface ISQLServerDataSource
authenticationScheme
- Values are "JavaKerberos" and the default "NativeAuthentication".public void setAuthentication(String authentication)
authentication
- the authentication modepublic String getAuthentication()
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)
ISQLServerDataSource
setLastUpdateCount
in interface ISQLServerDataSource
lastUpdateCount
- true if lastUpdateCount is enabled. Otherwise, false.public boolean getLastUpdateCount()
ISQLServerDataSource
getLastUpdateCount
in interface ISQLServerDataSource
public void setEncrypt(boolean encrypt)
ISQLServerDataSource
setEncrypt
in interface ISQLServerDataSource
encrypt
- true if the Secure Sockets Layer (SSL) encryption is enabled between the client and the SQL Server. Otherwise, false.public boolean getEncrypt()
ISQLServerDataSource
getEncrypt
in interface ISQLServerDataSource
public 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)
ISQLServerDataSource
setTrustServerCertificate
in interface ISQLServerDataSource
e
- 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()
ISQLServerDataSource
getTrustServerCertificate
in interface ISQLServerDataSource
public void setTrustStoreType(String trustStoreType)
public String getTrustStoreType()
public void setTrustStore(String st)
ISQLServerDataSource
setTrustStore
in interface ISQLServerDataSource
st
- A String that contains the path (including file name) to the certificate trustStore file.public String getTrustStore()
ISQLServerDataSource
getTrustStore
in interface ISQLServerDataSource
public void setTrustStorePassword(String p)
ISQLServerDataSource
setTrustStorePassword
in interface ISQLServerDataSource
p
- A String that contains the password that is used to check the integrity of the trustStore data.public void setHostNameInCertificate(String host)
ISQLServerDataSource
setHostNameInCertificate
in interface ISQLServerDataSource
host
- A String that contains the host name.public String getHostNameInCertificate()
ISQLServerDataSource
getHostNameInCertificate
in interface ISQLServerDataSource
public void setLockTimeout(int lockTimeout)
ISQLServerDataSource
setLockTimeout
in interface ISQLServerDataSource
lockTimeout
- An int value that contains the number of milliseconds to wait.public int getLockTimeout()
ISQLServerDataSource
getLockTimeout
in interface ISQLServerDataSource
public void setPassword(String password)
ISQLServerDataSource
setPassword
in interface ISQLServerDataSource
password
- A String that contains the password.public void setPortNumber(int portNumber)
ISQLServerDataSource
setPortNumber
in interface ISQLServerDataSource
portNumber
- An int value that contains the port number.public int getPortNumber()
ISQLServerDataSource
getPortNumber
in interface ISQLServerDataSource
public void setSelectMethod(String selectMethod)
ISQLServerDataSource
setSelectMethod
in interface ISQLServerDataSource
selectMethod
- A String value that contains the default cursor type.public String getSelectMethod()
ISQLServerDataSource
getSelectMethod
in interface ISQLServerDataSource
public void setResponseBuffering(String respo)
ISQLServerDataSource
setResponseBuffering
in interface ISQLServerDataSource
respo
- 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()
ISQLServerDataSource
getResponseBuffering
in interface ISQLServerDataSource
public void setApplicationIntent(String applicationIntent)
ISQLServerDataSource
setApplicationIntent
in interface ISQLServerDataSource
applicationIntent
- A String that contains the application intent.public String getApplicationIntent()
ISQLServerDataSource
getApplicationIntent
in interface ISQLServerDataSource
public void setSendTimeAsDatetime(boolean sendTimeAsDatetime)
ISQLServerDataSource
setSendTimeAsDatetime
in interface ISQLServerDataSource
sendTimeAsDatetime
- 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()
ISQLServerDataSource
getSendTimeAsDatetime
in interface ISQLServerDataSource
public void setSendStringParametersAsUnicode(boolean sendStringParametersAsUnicode)
ISQLServerDataSource
setSendStringParametersAsUnicode
in interface ISQLServerDataSource
sendStringParametersAsUnicode
- true if string parameters are sent to the server in UNICODE format. Otherwise, false.public boolean getSendStringParametersAsUnicode()
ISQLServerDataSource
getSendStringParametersAsUnicode
in interface ISQLServerDataSource
public 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)
ISQLServerDataSource
setServerName
in interface ISQLServerDataSource
serverName
- A String that contains the server name.public String getServerName()
ISQLServerDataSource
getServerName
in interface ISQLServerDataSource
public void setServerSpn(String serverSpn)
ISQLServerDataSource
setServerSpn
in interface ISQLServerDataSource
serverSpn
- A String that contains the server spnpublic String getServerSpn()
ISQLServerDataSource
getServerSpn
in interface ISQLServerDataSource
public void setFailoverPartner(String serverName)
ISQLServerDataSource
setFailoverPartner
in interface ISQLServerDataSource
serverName
- A String that contains the failover server name.public String getFailoverPartner()
ISQLServerDataSource
getFailoverPartner
in interface ISQLServerDataSource
public void setMultiSubnetFailover(boolean multiSubnetFailover)
ISQLServerDataSource
setMultiSubnetFailover
in interface ISQLServerDataSource
multiSubnetFailover
- The new value of the multiSubnetFailover connection property.public boolean getMultiSubnetFailover()
ISQLServerDataSource
getMultiSubnetFailover
in interface ISQLServerDataSource
public void setUser(String user)
ISQLServerDataSource
setUser
in interface ISQLServerDataSource
user
- A String that contains the user name.public String getUser()
ISQLServerDataSource
getUser
in interface ISQLServerDataSource
public void setWorkstationID(String workstationID)
ISQLServerDataSource
setWorkstationID
in interface ISQLServerDataSource
workstationID
- A String that contains the client computer name.public String getWorkstationID()
ISQLServerDataSource
getWorkstationID
in interface ISQLServerDataSource
public void setXopenStates(boolean xopenStates)
ISQLServerDataSource
setXopenStates
in interface ISQLServerDataSource
xopenStates
- true if converting SQL states to XOPEN compliant states is enabled. Otherwise, false.public boolean getXopenStates()
ISQLServerDataSource
getXopenStates
in interface ISQLServerDataSource
public void setFIPSProvider(String fipsProvider)
public String getFIPSProvider()
public void setURL(String url)
ISQLServerDataSource
setURL
in interface ISQLServerDataSource
url
- A String that contains the URL.public String getURL()
ISQLServerDataSource
getURL
in interface ISQLServerDataSource
public void setDescription(String description)
ISQLServerDataSource
setDescription
in interface ISQLServerDataSource
description
- A String that contains the description.public String getDescription()
ISQLServerDataSource
getDescription
in interface ISQLServerDataSource
public void setPacketSize(int packetSize)
ISQLServerDataSource
setPacketSize
in interface ISQLServerDataSource
packetSize
- An int value containing the network packet size.public int getPacketSize()
ISQLServerDataSource
getPacketSize
in interface ISQLServerDataSource
public void setQueryTimeout(int queryTimeout)
public int getQueryTimeout()
public void setSocketTimeout(int socketTimeout)
public int getSocketTimeout()
public Reference getReference()
getReference
in interface Referenceable
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
Copyright © 2017 Microsoft Corporation. All rights reserved.