Class SQLServerDataSource

    • Constructor Summary

      Constructors 
      Constructor Description
      SQLServerDataSource()
      Constructs a SQLServerDataSource.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAccessToken()
      Returns the access token.
      java.lang.String getApplicationIntent()
      Returns the application intent.
      java.lang.String getApplicationName()
      Returns the application name.
      java.lang.String getAuthentication()
      Returns the authentication mode.
      int getCancelQueryTimeout()
      Returns the cancel timeout.
      java.lang.String getColumnEncryptionSetting()
      Returns the Always Encrypted functionality setting for the data source object.
      java.sql.Connection getConnection()  
      java.sql.Connection getConnection​(java.lang.String username, java.lang.String password)  
      java.lang.String getDatabaseName()
      Returns the database name.
      java.lang.String getDescription()
      Returns the DataSource description
      boolean getDisableStatementPooling()
      Returns whether statement pooling is disabled.
      boolean getEnablePrepareOnFirstPreparedStatementCall()
      Returns the value that indicates whether the first execution of a prepared statement will call sp_executesql and not prepare a statement.
      boolean getEncrypt()
      Returns a Boolean value that indicates if the encrypt property is enabled.
      java.lang.String getFailoverPartner()
      Returns the name of the failover server that is used in a database mirroring configuration.
      boolean getFIPS()
      Returns the value of connection property "fips".
      org.ietf.jgss.GSSCredential getGSSCredentials()
      Returns the GSSCredential.
      java.lang.String getHostNameInCertificate()
      Returns the host name used in validating the SQL Server Secure Sockets Layer (SSL) certificate.
      java.lang.String getInstanceName()
      Returns the SQL Server instance name.
      java.lang.String getJASSConfigurationName()
      Returns the login configuration file for Kerberos authentication.
      java.lang.String getKeyStoreAuthentication()
      Returns the value of the keyStoreAuthentication setting for the data source object.
      java.lang.String getKeyStoreLocation()
      Returns 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()  
      java.io.PrintWriter getLogWriter()
      Returns the log writer for this DataSource.
      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.
      java.util.logging.Logger getParentLogger()  
      int getPortNumber()
      Returns the current port number that is used to communicate with SQL Server.
      int getQueryTimeout()
      Returns the query timeout.
      javax.naming.Reference getReference()  
      java.lang.String getResponseBuffering()
      Returns the response buffering mode for this SQLServerDataSource object.
      java.lang.String getSelectMethod()
      Returns the default cursor type used for all result sets that are created by using this SQLServerDataSource object.
      boolean getSendStringParametersAsUnicode()
      Returns whether sending string parameters to the server in UNICODE format is enabled.
      boolean getSendTimeAsDatetime()
      Returns the value of the sendTimeAsDatetime connection property.
      java.lang.String getServerName()
      Returns the name of the SQL Server instance.
      boolean getServerNameAsACE()
      Returns if the serverName should be translated from Unicode to ASCII Compatible Encoding (ACE).
      int getServerPreparedStatementDiscardThreshold()
      Returns the value of the setting that 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.
      java.lang.String getServerSpn()
      Returns the server spn.
      int getSocketTimeout()
      Returns the socket timeout value.
      java.lang.String getSSLProtocol()
      Returns the value of connection property 'sslProtocol'.
      int getStatementPoolingCacheSize()
      Returns the size of the prepared statement cache for this connection.
      boolean getTransparentNetworkIPResolution()
      Returns the TransparentNetworkIPResolution value.
      java.lang.String getTrustManagerClass()
      Returns the value for the connection property 'trustManagerClass'.
      java.lang.String getTrustManagerConstructorArg()
      Returns the value for the connection property 'trustManagerConstructorArg'.
      boolean getTrustServerCertificate()
      Returns a Boolean value that indicates if the trustServerCertificate property is enabled.
      java.lang.String getTrustStore()
      Returns the path (including file name) to the certificate trustStore file.
      java.lang.String getTrustStoreType()
      Returns the keyStore Type for the trustStore.
      java.lang.String getURL()
      Returns the URL that is used to connect to the data source.
      boolean getUseBulkCopyForBatchInsert()
      Returns whether the use Bulk Copy API is used for Batch Insert.
      java.lang.String getUser()
      Returns the user name that is used to connect the data source.
      java.lang.String getWorkstationID()
      Returns the name of the client computer name that is used to connect to the data source.
      boolean getXopenStates()
      Returns the value that indicates if converting SQL states to XOPEN compliant states is enabled.
      boolean isWrapperFor​(java.lang.Class<?> iface)  
      void setAccessToken​(java.lang.String accessToken)
      Sets the access token.
      void setApplicationIntent​(java.lang.String applicationIntent)
      Sets the application intent.
      void setApplicationName​(java.lang.String applicationName)
      Sets the specific application in various SQL Server profiling and logging tools.
      void setAuthentication​(java.lang.String authentication)
      Sets the authentication mode.
      void setAuthenticationScheme​(java.lang.String authenticationScheme)
      Sets the kind of integrated security you want your application to use.
      void setCancelQueryTimeout​(int cancelQueryTimeout)
      Sets the cancel timeout.
      void setColumnEncryptionSetting​(java.lang.String columnEncryptionSetting)
      Sets the Column Encryption setting.
      void setDatabaseName​(java.lang.String databaseName)
      Sets the the database to connect to.
      void setDescription​(java.lang.String description)
      Sets the DataSource description.
      void setDisableStatementPooling​(boolean disableStatementPooling)
      Sets the value to disable/enable statement pooling.
      void setEnablePrepareOnFirstPreparedStatementCall​(boolean enablePrepareOnFirstPreparedStatementCall)
      Sets the value that enables/disables whether the first execution of a prepared statement will call sp_executesql and not prepare a statement.
      void setEncrypt​(boolean encrypt)
      Sets a Boolean value that indicates if the encrypt property is enabled.
      void setFailoverPartner​(java.lang.String serverName)
      Sets the fail over partner of the target SQL Server.
      void setFIPS​(boolean fips)
      Sets whether Fips Mode should be enabled/disabled on the connection.
      void setGSSCredentials​(org.ietf.jgss.GSSCredential userCredential)
      Sets the GSSCredential.
      void setHostNameInCertificate​(java.lang.String hostName)
      Sets the host name to be used in validating the SQL Server Secure Sockets Layer (SSL) certificate.
      void setInstanceName​(java.lang.String instanceName)
      Sets the the SQL Server instance name to connect to.
      void setIntegratedSecurity​(boolean enable)
      Sets a Boolean value that indicates if the integratedSecurity property is enabled.
      void setJASSConfigurationName​(java.lang.String configurationName)
      Sets the login configuration file for Kerberos authentication.
      void setKeyStoreAuthentication​(java.lang.String keyStoreAuthentication)
      Sets the name that identifies a key store.
      void setKeyStoreLocation​(java.lang.String keyStoreLocation)
      Sets the location including the file name for the Java keystore.
      void setKeyStoreSecret​(java.lang.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 the lock timeout value.
      void setLoginTimeout​(int loginTimeout)
      Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
      void setLogWriter​(java.io.PrintWriter out)  
      void setMultiSubnetFailover​(boolean multiSubnetFailover)
      Sets the value of the multiSubnetFailover connection property.
      void setPacketSize​(int packetSize)
      Sets the packet size.
      void setPassword​(java.lang.String password)
      Sets the password that will be used when connecting to SQL Server.
      void setPortNumber​(int portNumber)
      Sets the TCP-IP port number used when opening a socket connection to SQL Server.
      void setQueryTimeout​(int queryTimeout)
      Setting the query timeout.
      void setResponseBuffering​(java.lang.String bufferingMode)
      Sets the response buffering mode for connections created by using this SQLServerDataSource object.
      void setSelectMethod​(java.lang.String selectMethod)
      Sets the default cursor type used for the result set.
      void setSendStringParametersAsUnicode​(boolean sendStringParametersAsUnicode)
      Sets whether string parameters are sent to the server in UNICODE format.
      void setSendTimeAsDatetime​(boolean sendTimeAsDatetime)
      Sets the value to enable/disable the sendTimeAsDatetime connection property.
      void setServerName​(java.lang.String serverName)
      Sets the host name of the target SQL Server.
      void setServerNameAsACE​(boolean serverNameAsACE)
      Sets whether the serverName will be translated from Unicode to ASCII Compatible Encoding (ACE).
      void setServerPreparedStatementDiscardThreshold​(int serverPreparedStatementDiscardThreshold)
      Sets the value that 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​(java.lang.String serverSpn)
      Sets the Service Principal Name (SPN) of the target SQL Server.
      void setSocketTimeout​(int socketTimeout)
      Sets the socket timeout value.
      void setSSLProtocol​(java.lang.String sslProtocol)
      Sets the sslProtocol property for connection Set this value to specify TLS protocol keyword.
      void setStatementPoolingCacheSize​(int statementPoolingCacheSize)
      Sets the size of the prepared statement cache for this connection.
      void setTransparentNetworkIPResolution​(boolean tnir)
      Sets the value to enable/disable Transparent Netowrk IP Resolution (TNIR).
      void setTrustManagerClass​(java.lang.String trustManagerClass)
      Sets the connection property 'trustManagerClass' on the connection.
      void setTrustManagerConstructorArg​(java.lang.String trustManagerConstructorArg)
      Sets Constructor Arguments to be provided on constructor of 'trustManagerClass'.
      void setTrustServerCertificate​(boolean e)
      Sets a Boolean value that indicates if the trustServerCertificate property is enabled.
      void setTrustStore​(java.lang.String trustStore)
      Sets the path (including file name) to the certificate trustStore file.
      void setTrustStorePassword​(java.lang.String trustStorePassword)
      Sets the password that is used to check the integrity of the trustStore data.
      void setTrustStoreType​(java.lang.String trustStoreType)
      Sets the keystore type for the trustStore.
      void setURL​(java.lang.String url)
      Sets the datasource URL.
      void setUseBulkCopyForBatchInsert​(boolean useBulkCopyForBatchInsert)
      Sets whether the use Bulk Copy API should be used for Batch Insert.
      void setUser​(java.lang.String user)
      Sets the user name that will be used when connecting to SQL Server.
      void setWorkstationID​(java.lang.String workstationID)
      Sets the name of the client machine (or client workstation).
      void setXopenStates​(boolean xopenStates)
      Sets whether the driver will convert SQL states to XOPEN compliant states.
      java.lang.String toString()  
      <T> T unwrap​(java.lang.Class<T> iface)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface javax.sql.CommonDataSource

        createShardingKeyBuilder
      • Methods inherited from interface javax.sql.DataSource

        createConnectionBuilder
    • Constructor Detail

      • SQLServerDataSource

        public SQLServerDataSource()
        Constructs a SQLServerDataSource.
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getConnection

        public java.sql.Connection getConnection​(java.lang.String username,
                                                 java.lang.String password)
                                          throws SQLServerException
        Specified by:
        getConnection in interface javax.sql.DataSource
        Throws:
        SQLServerException
      • setLoginTimeout

        public void setLoginTimeout​(int loginTimeout)
        Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. Note default value is 0.
        Specified by:
        setLoginTimeout in interface javax.sql.CommonDataSource
        Specified by:
        setLoginTimeout in interface javax.sql.DataSource
      • getLoginTimeout

        public int getLoginTimeout()
        Specified by:
        getLoginTimeout in interface javax.sql.CommonDataSource
        Specified by:
        getLoginTimeout in interface javax.sql.DataSource
      • setLogWriter

        public void setLogWriter​(java.io.PrintWriter out)
        Specified by:
        setLogWriter in interface javax.sql.CommonDataSource
        Specified by:
        setLogWriter in interface javax.sql.DataSource
      • getLogWriter

        public java.io.PrintWriter getLogWriter()
        Returns the log writer for this DataSource.
        Specified by:
        getLogWriter in interface javax.sql.CommonDataSource
        Specified by:
        getLogWriter in interface javax.sql.DataSource
      • getParentLogger

        public java.util.logging.Logger getParentLogger()
                                                 throws java.sql.SQLFeatureNotSupportedException
        Specified by:
        getParentLogger in interface javax.sql.CommonDataSource
        Throws:
        java.sql.SQLFeatureNotSupportedException
      • setApplicationName

        public void setApplicationName​(java.lang.String applicationName)
        Sets the specific application in various SQL Server profiling and logging tools.
        Specified by:
        setApplicationName in interface ISQLServerDataSource
        Parameters:
        applicationName - A String that contains the name of the application.
      • getApplicationName

        public java.lang.String getApplicationName()
        Description copied from interface: ISQLServerDataSource
        Returns the application name.
        Specified by:
        getApplicationName in interface ISQLServerDataSource
        Returns:
        A String that contains the application name, or "Microsoft JDBC Driver for SQL Server" if no value is set.
      • setDatabaseName

        public void setDatabaseName​(java.lang.String databaseName)
        Sets the the database to connect to.
        Specified by:
        setDatabaseName in interface ISQLServerDataSource
        Parameters:
        databaseName - if not set, returns the default value of null.
      • getDatabaseName

        public java.lang.String getDatabaseName()
        Description copied from interface: ISQLServerDataSource
        Returns the database name.
        Specified by:
        getDatabaseName in interface ISQLServerDataSource
        Returns:
        A String that contains the database name or null if no value is set.
      • setInstanceName

        public void setInstanceName​(java.lang.String instanceName)
        Sets the the SQL Server instance name to connect to.
        Specified by:
        setInstanceName in interface ISQLServerDataSource
        Parameters:
        instanceName - if not set, returns the default value of null.
      • getInstanceName

        public java.lang.String getInstanceName()
        Description copied from interface: ISQLServerDataSource
        Returns the SQL Server instance name.
        Specified by:
        getInstanceName in interface ISQLServerDataSource
        Returns:
        A String that contains the instance name, or null if no value is set.
      • setIntegratedSecurity

        public void setIntegratedSecurity​(boolean enable)
        Description copied from interface: ISQLServerDataSource
        Sets a Boolean value that indicates if the integratedSecurity property is enabled.
        Specified by:
        setIntegratedSecurity in interface ISQLServerDataSource
        Parameters:
        enable - true if integratedSecurity is enabled. Otherwise, false.
      • setAuthenticationScheme

        public void setAuthenticationScheme​(java.lang.String authenticationScheme)
        Description copied from interface: ISQLServerDataSource
        Sets the kind of integrated security you want your application to use.
        Specified by:
        setAuthenticationScheme in interface ISQLServerDataSource
        Parameters:
        authenticationScheme - Values are "JavaKerberos" and the default "NativeAuthentication".
      • setAuthentication

        public void setAuthentication​(java.lang.String authentication)
        Description copied from interface: ISQLServerDataSource
        Sets the authentication mode.
        Specified by:
        setAuthentication in interface ISQLServerDataSource
        Parameters:
        authentication - the authentication mode
      • setGSSCredentials

        public void setGSSCredentials​(org.ietf.jgss.GSSCredential userCredential)
        Description copied from interface: ISQLServerDataSource
        Sets the GSSCredential.
        Specified by:
        setGSSCredentials in interface ISQLServerDataSource
        Parameters:
        userCredential - the credential
      • setAccessToken

        public void setAccessToken​(java.lang.String accessToken)
        Description copied from interface: ISQLServerDataSource
        Sets the access token.
        Specified by:
        setAccessToken in interface ISQLServerDataSource
        Parameters:
        accessToken - to be set in the string property.
      • setColumnEncryptionSetting

        public void setColumnEncryptionSetting​(java.lang.String columnEncryptionSetting)
        Sets the Column Encryption setting. If lastUpdateCount is set to true, the driver will return only the last update count from all the update counts returned by a batch. The default of false will return all update counts. If lastUpdateCount is not set, getLastUpdateCount returns the default value of false.
        Specified by:
        setColumnEncryptionSetting in interface ISQLServerDataSource
        Parameters:
        columnEncryptionSetting - Enables/disables Always Encrypted functionality for the data source object. The default is Disabled.
      • getColumnEncryptionSetting

        public java.lang.String getColumnEncryptionSetting()
        Description copied from interface: ISQLServerDataSource
        Returns the Always Encrypted functionality setting for the data source object.
        Specified by:
        getColumnEncryptionSetting in interface ISQLServerDataSource
        Returns:
        the Always Encrypted functionality setting for the data source object.
      • setKeyStoreAuthentication

        public void setKeyStoreAuthentication​(java.lang.String keyStoreAuthentication)
        Description copied from interface: ISQLServerDataSource
        Sets the name that identifies a key store. Only value supported is the "JavaKeyStorePassword" for identifying the Java Key Store. The default is null.
        Specified by:
        setKeyStoreAuthentication in interface ISQLServerDataSource
        Parameters:
        keyStoreAuthentication - the name that identifies a key store.
      • getKeyStoreAuthentication

        public java.lang.String getKeyStoreAuthentication()
        Description copied from interface: ISQLServerDataSource
        Returns the value of the keyStoreAuthentication setting for the data source object.
        Specified by:
        getKeyStoreAuthentication in interface ISQLServerDataSource
        Returns:
        the value of the keyStoreAuthentication setting for the data source object.
      • setKeyStoreSecret

        public void setKeyStoreSecret​(java.lang.String keyStoreSecret)
        Description copied from interface: ISQLServerDataSource
        Sets the password for the Java keystore. Note that, for Java Key Store provider the password for the keystore and the key must be the same. Note that, keyStoreAuthentication must be set with "JavaKeyStorePassword".
        Specified by:
        setKeyStoreSecret in interface ISQLServerDataSource
        Parameters:
        keyStoreSecret - the password to use for the keystore as well as for the key
      • setKeyStoreLocation

        public void setKeyStoreLocation​(java.lang.String keyStoreLocation)
        Description copied from interface: ISQLServerDataSource
        Sets the location including the file name for the Java keystore. Note that, keyStoreAuthentication must be set with "JavaKeyStorePassword".
        Specified by:
        setKeyStoreLocation in interface ISQLServerDataSource
        Parameters:
        keyStoreLocation - the location including the file name for the Java keystore.
      • getKeyStoreLocation

        public java.lang.String getKeyStoreLocation()
        Description copied from interface: ISQLServerDataSource
        Returns the keyStoreLocation for the Java Key Store.
        Specified by:
        getKeyStoreLocation in interface ISQLServerDataSource
        Returns:
        the keyStoreLocation for the Java Key Store.
      • setLastUpdateCount

        public void setLastUpdateCount​(boolean lastUpdateCount)
        Description copied from interface: ISQLServerDataSource
        Sets a Boolean value that indicates if the lastUpdateCount property is enabled.
        Specified by:
        setLastUpdateCount in interface ISQLServerDataSource
        Parameters:
        lastUpdateCount - true if lastUpdateCount is enabled. Otherwise, false.
      • getLastUpdateCount

        public boolean getLastUpdateCount()
        Description copied from interface: ISQLServerDataSource
        Returns a Boolean value that indicates if the lastUpdateCount property is enabled.
        Specified by:
        getLastUpdateCount in interface ISQLServerDataSource
        Returns:
        true if lastUpdateCount is enabled. Otherwise, false.
      • setEncrypt

        public void setEncrypt​(boolean encrypt)
        Description copied from interface: ISQLServerDataSource
        Sets a Boolean value that indicates if the encrypt property is enabled.
        Specified by:
        setEncrypt in interface ISQLServerDataSource
        Parameters:
        encrypt - true if the Secure Sockets Layer (SSL) encryption is enabled between the client and the SQL Server. Otherwise, false.
      • getEncrypt

        public boolean getEncrypt()
        Description copied from interface: ISQLServerDataSource
        Returns a Boolean value that indicates if the encrypt property is enabled.
        Specified by:
        getEncrypt in interface ISQLServerDataSource
        Returns:
        true if encrypt is enabled. Otherwise, false.
      • setTransparentNetworkIPResolution

        public void setTransparentNetworkIPResolution​(boolean tnir)
        Description copied from interface: ISQLServerDataSource
        Sets the value to enable/disable Transparent Netowrk IP Resolution (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. When transparentNetworkIPResolution is true, the driver attempts to connect to the first IP address available. If the first attempt fails, the driver tries to connect to all IP addresses in parallel until the timeout expires, discarding any pending connection attempts when one of them succeeds.

        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

        Specified by:
        setTransparentNetworkIPResolution in interface ISQLServerDataSource
        Parameters:
        tnir - if set to true, the driver attempts to connect to the first IP address available. It is true by default.
      • setTrustServerCertificate

        public void setTrustServerCertificate​(boolean e)
        Description copied from interface: ISQLServerDataSource
        Sets a Boolean value that indicates if the trustServerCertificate property is enabled.
        Specified by:
        setTrustServerCertificate in interface ISQLServerDataSource
        Parameters:
        e - true, if the server Secure Sockets Layer (SSL) certificate should be automatically trusted when the communication layer is encrypted using SSL. Otherwise, false.
      • getTrustServerCertificate

        public boolean getTrustServerCertificate()
        Description copied from interface: ISQLServerDataSource
        Returns a Boolean value that indicates if the trustServerCertificate property is enabled.
        Specified by:
        getTrustServerCertificate in interface ISQLServerDataSource
        Returns:
        true if trustServerCertificate is enabled. Otherwise, false.
      • setTrustStoreType

        public void setTrustStoreType​(java.lang.String trustStoreType)
        Description copied from interface: ISQLServerDataSource
        Sets the keystore type for the trustStore.
        Specified by:
        setTrustStoreType in interface ISQLServerDataSource
        Parameters:
        trustStoreType - A String that contains the trust store type
      • getTrustStoreType

        public java.lang.String getTrustStoreType()
        Description copied from interface: ISQLServerDataSource
        Returns the keyStore Type for the trustStore.
        Specified by:
        getTrustStoreType in interface ISQLServerDataSource
        Returns:
        trustStoreType A String that contains the trust store type
      • setTrustStore

        public void setTrustStore​(java.lang.String trustStore)
        Description copied from interface: ISQLServerDataSource
        Sets the path (including file name) to the certificate trustStore file.
        Specified by:
        setTrustStore in interface ISQLServerDataSource
        Parameters:
        trustStore - A String that contains the path (including file name) to the certificate trustStore file.
      • getTrustStore

        public java.lang.String getTrustStore()
        Description copied from interface: ISQLServerDataSource
        Returns the path (including file name) to the certificate trustStore file.
        Specified by:
        getTrustStore in interface ISQLServerDataSource
        Returns:
        trustStore A String that contains the path (including file name) to the certificate trustStore file, or null if no value is set.
      • setTrustStorePassword

        public void setTrustStorePassword​(java.lang.String trustStorePassword)
        Description copied from interface: ISQLServerDataSource
        Sets the password that is used to check the integrity of the trustStore data.
        Specified by:
        setTrustStorePassword in interface ISQLServerDataSource
        Parameters:
        trustStorePassword - A String that contains the password that is used to check the integrity of the trustStore data.
      • setHostNameInCertificate

        public void setHostNameInCertificate​(java.lang.String hostName)
        Description copied from interface: ISQLServerDataSource
        Sets the host name to be used in validating the SQL Server Secure Sockets Layer (SSL) certificate.
        Specified by:
        setHostNameInCertificate in interface ISQLServerDataSource
        Parameters:
        hostName - A String that contains the host name.
      • getHostNameInCertificate

        public java.lang.String getHostNameInCertificate()
        Description copied from interface: ISQLServerDataSource
        Returns the host name used in validating the SQL Server Secure Sockets Layer (SSL) certificate.
        Specified by:
        getHostNameInCertificate in interface ISQLServerDataSource
        Returns:
        A String that contains the host name, or null if no value is set.
      • setLockTimeout

        public void setLockTimeout​(int lockTimeout)
        Sets the lock timeout value.
        Specified by:
        setLockTimeout in interface ISQLServerDataSource
        Parameters:
        lockTimeout - the number of milliseconds to wait before the database reports a lock timeout. The default value of -1 means wait forever. If specified, this value will be the default for all statements on the connection. Note a value of 0 means no wait. If lockTimeout is not set, getLockTimeout returns the default of -1.
      • getLockTimeout

        public int getLockTimeout()
        Description copied from interface: ISQLServerDataSource
        Returns an int value that indicates the number of milliseconds that the database will wait before reporting a lock time out.
        Specified by:
        getLockTimeout in interface ISQLServerDataSource
        Returns:
        An int value that contains the number of milliseconds that the database will wait.
      • setPassword

        public void setPassword​(java.lang.String password)
        Sets the password that will be used when connecting to SQL Server.
        Specified by:
        setPassword in interface ISQLServerDataSource
        Parameters:
        password - Note getPassword is deliberately declared non-public for security reasons. If the password is not set, getPassword returns the default value of null.
      • setPortNumber

        public void setPortNumber​(int portNumber)
        Sets the TCP-IP port number used when opening a socket connection to SQL Server.
        Specified by:
        setPortNumber in interface ISQLServerDataSource
        Parameters:
        portNumber - if not set, getPortNumber returns the default of 1433. Note as mentioned above, setPortNumber does not do any range checking on the port value passed in,\ invalid port numbers like 99999 can be passed in without triggering any error.
      • getPortNumber

        public int getPortNumber()
        Description copied from interface: ISQLServerDataSource
        Returns the current port number that is used to communicate with SQL Server.
        Specified by:
        getPortNumber in interface ISQLServerDataSource
        Returns:
        An int value that contains the current port number.
      • setSelectMethod

        public void setSelectMethod​(java.lang.String selectMethod)
        Sets the default cursor type used for the result set.
        Specified by:
        setSelectMethod in interface ISQLServerDataSource
        Parameters:
        selectMethod - This(non-Javadoc) @see com.microsoft.sqlserver.jdbc.ISQLServerDataSource#setSelectMethod(java.lang.String) property is useful when you are dealing with large result sets and do not want to store the whole result set in memory on the client side. By setting the property to "cursor" you will be able to create a server side cursor that can fetch smaller chunks of data at a time. If selectMethod is not set, getSelectMethod returns the default value of "direct".
      • getSelectMethod

        public java.lang.String getSelectMethod()
        Description copied from interface: ISQLServerDataSource
        Returns the default cursor type used for all result sets that are created by using this SQLServerDataSource object.
        Specified by:
        getSelectMethod in interface ISQLServerDataSource
        Returns:
        A String value that contains the default cursor type.
      • setResponseBuffering

        public void setResponseBuffering​(java.lang.String bufferingMode)
        Description copied from interface: ISQLServerDataSource
        Sets the response buffering mode for connections created by using this SQLServerDataSource object.
        Specified by:
        setResponseBuffering in interface ISQLServerDataSource
        Parameters:
        bufferingMode - A String that contains the buffering and streaming mode. The valid mode can be one of the following case-insensitive Strings: full or adaptive.
      • getResponseBuffering

        public java.lang.String getResponseBuffering()
        Description copied from interface: ISQLServerDataSource
        Returns the response buffering mode for this SQLServerDataSource object.
        Specified by:
        getResponseBuffering in interface ISQLServerDataSource
        Returns:
        A String that contains a lower-case full or adaptive.
      • setApplicationIntent

        public void setApplicationIntent​(java.lang.String applicationIntent)
        Description copied from interface: ISQLServerDataSource
        Sets the application intent.
        Specified by:
        setApplicationIntent in interface ISQLServerDataSource
        Parameters:
        applicationIntent - A String that contains the application intent.
      • setSendTimeAsDatetime

        public void setSendTimeAsDatetime​(boolean sendTimeAsDatetime)
        Description copied from interface: ISQLServerDataSource
        Sets the value to enable/disable the sendTimeAsDatetime connection property.
        Specified by:
        setSendTimeAsDatetime in interface ISQLServerDataSource
        Parameters:
        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.
      • getSendTimeAsDatetime

        public boolean getSendTimeAsDatetime()
        Description copied from interface: ISQLServerDataSource
        Returns the value of the sendTimeAsDatetime connection property. This method was added in SQL Server JDBC Driver 3.0. Returns the setting of the sendTimeAsDatetime connection property.
        Specified by:
        getSendTimeAsDatetime in interface ISQLServerDataSource
        Returns:
        true if java.sql.Time values will be sent to the server as a SQL Server datetime type. false if java.sql.Time values will be sent to the server as a SQL Server time type.
      • setSendStringParametersAsUnicode

        public void setSendStringParametersAsUnicode​(boolean sendStringParametersAsUnicode)
        Sets whether string parameters are sent to the server in UNICODE format.
        Specified by:
        setSendStringParametersAsUnicode in interface ISQLServerDataSource
        Parameters:
        sendStringParametersAsUnicode - if true (default), string parameters are sent to the server in UNICODE format. if false, string parameters are sent to the server in the native TDS collation format of the database, not in UNICODE. if set, returns the default of true.
      • getSendStringParametersAsUnicode

        public boolean getSendStringParametersAsUnicode()
        Description copied from interface: ISQLServerDataSource
        Returns whether sending string parameters to the server in UNICODE format is enabled.
        Specified by:
        getSendStringParametersAsUnicode in interface ISQLServerDataSource
        Returns:
        true if string parameters are sent to the server in UNICODE format. Otherwise, false.
      • setServerNameAsACE

        public void setServerNameAsACE​(boolean serverNameAsACE)
        Description copied from interface: ISQLServerDataSource
        Sets whether the serverName will be translated from Unicode to ASCII Compatible Encoding (ACE).
        Specified by:
        setServerNameAsACE in interface ISQLServerDataSource
        Parameters:
        serverNameAsACE - if enabled the servername will be translated to ASCII Compatible Encoding (ACE)
      • getServerNameAsACE

        public boolean getServerNameAsACE()
        Description copied from interface: ISQLServerDataSource
        Returns if the serverName should be translated from Unicode to ASCII Compatible Encoding (ACE).
        Specified by:
        getServerNameAsACE in interface ISQLServerDataSource
        Returns:
        if enabled, will return true. Otherwise, false.
      • setServerName

        public void setServerName​(java.lang.String serverName)
        Sets the host name of the target SQL Server.
        Specified by:
        setServerName in interface ISQLServerDataSource
        Parameters:
        serverName - if not set, returns the default value of null is returned.
      • getServerName

        public java.lang.String getServerName()
        Description copied from interface: ISQLServerDataSource
        Returns the name of the SQL Server instance.
        Specified by:
        getServerName in interface ISQLServerDataSource
        Returns:
        A String that contains the server name or null if no value is set.
      • setServerSpn

        public void setServerSpn​(java.lang.String serverSpn)
        Sets the Service Principal Name (SPN) of the target SQL Server. https://msdn.microsoft.com/en-us/library/cc280459.aspx
        Specified by:
        setServerSpn in interface ISQLServerDataSource
        Parameters:
        serverSpn - service principal name
      • setFailoverPartner

        public void setFailoverPartner​(java.lang.String serverName)
        Sets the fail over partner of the target SQL Server.
        Specified by:
        setFailoverPartner in interface ISQLServerDataSource
        Parameters:
        serverName - if not set, returns the default value of null.
      • getFailoverPartner

        public java.lang.String getFailoverPartner()
        Description copied from interface: ISQLServerDataSource
        Returns the name of the failover server that is used in a database mirroring configuration.
        Specified by:
        getFailoverPartner in interface ISQLServerDataSource
        Returns:
        A String that contains the name of the failover partner, or null if none is set.
      • setMultiSubnetFailover

        public void setMultiSubnetFailover​(boolean multiSubnetFailover)
        Description copied from interface: ISQLServerDataSource
        Sets the value of the multiSubnetFailover connection property.
        Specified by:
        setMultiSubnetFailover in interface ISQLServerDataSource
        Parameters:
        multiSubnetFailover - The new value of the multiSubnetFailover connection property.
      • getMultiSubnetFailover

        public boolean getMultiSubnetFailover()
        Description copied from interface: ISQLServerDataSource
        Returns the value of the multiSubnetFailover connection property.
        Specified by:
        getMultiSubnetFailover in interface ISQLServerDataSource
        Returns:
        Returns true or false, depending on the current setting of the connection property.
      • setUser

        public void setUser​(java.lang.String user)
        Sets the user name that will be used when connecting to SQL Server.
        Specified by:
        setUser in interface ISQLServerDataSource
        Parameters:
        user - if not set, returns the default value of null.
      • getUser

        public java.lang.String getUser()
        Description copied from interface: ISQLServerDataSource
        Returns the user name that is used to connect the data source.
        Specified by:
        getUser in interface ISQLServerDataSource
        Returns:
        A String that contains the user name.
      • setWorkstationID

        public void setWorkstationID​(java.lang.String workstationID)
        Sets the name of the client machine (or client workstation).
        Specified by:
        setWorkstationID in interface ISQLServerDataSource
        Parameters:
        workstationID - host name of the client. if not set, the default value is constructed by calling InetAddress.getLocalHost().getHostName() or if getHostName() returns blank then getHostAddress().toString().
      • getWorkstationID

        public java.lang.String getWorkstationID()
        Description copied from interface: ISQLServerDataSource
        Returns the name of the client computer name that is used to connect to the data source.
        Specified by:
        getWorkstationID in interface ISQLServerDataSource
        Returns:
        A String that contains the client computer name.
      • setXopenStates

        public void setXopenStates​(boolean xopenStates)
        Sets whether the driver will convert SQL states to XOPEN compliant states.
        Specified by:
        setXopenStates in interface ISQLServerDataSource
        Parameters:
        xopenStates - if true, the driver will convert SQL states to XOPEN compliant states. The default is false which causes the driver to generate SQL 99 state codes. If not set, getXopenStates returns the default value of false.
      • getXopenStates

        public boolean getXopenStates()
        Description copied from interface: ISQLServerDataSource
        Returns the value that indicates if converting SQL states to XOPEN compliant states is enabled.
        Specified by:
        getXopenStates in interface ISQLServerDataSource
        Returns:
        true if converting SQL states to XOPEN compliant states is enabled. Otherwise, false.
      • setFIPS

        public void setFIPS​(boolean fips)
        Description copied from interface: ISQLServerDataSource
        Sets whether Fips Mode should be enabled/disabled on the connection. For FIPS enabled JVM this property should be true.
        Specified by:
        setFIPS in interface ISQLServerDataSource
        Parameters:
        fips - Boolean property to enable/disable fips
      • getFIPS

        public boolean getFIPS()
        Description copied from interface: ISQLServerDataSource
        Returns the value of connection property "fips". For FIPS enabled JVM this property should be true.
        Specified by:
        getFIPS in interface ISQLServerDataSource
        Returns:
        fips boolean value
      • setSSLProtocol

        public void setSSLProtocol​(java.lang.String sslProtocol)
        Description copied from interface: ISQLServerDataSource
        Sets the sslProtocol property for connection Set this value to specify TLS protocol keyword. Acceptable values are: TLS, TLSv1, TLSv1.1, and TLSv1.2.
        Specified by:
        setSSLProtocol in interface ISQLServerDataSource
        Parameters:
        sslProtocol - Value for SSL Protocol to be set.
      • getSSLProtocol

        public java.lang.String getSSLProtocol()
        Description copied from interface: ISQLServerDataSource
        Returns the value of connection property 'sslProtocol'.
        Specified by:
        getSSLProtocol in interface ISQLServerDataSource
        Returns:
        sslProtocol property value
      • setTrustManagerClass

        public void setTrustManagerClass​(java.lang.String trustManagerClass)
        Description copied from interface: ISQLServerDataSource
        Sets the connection property 'trustManagerClass' on the connection.
        Specified by:
        setTrustManagerClass in interface ISQLServerDataSource
        Parameters:
        trustManagerClass - The fully qualified class name of a custom javax.net.ssl.TrustManager.
      • getTrustManagerClass

        public java.lang.String getTrustManagerClass()
        Description copied from interface: ISQLServerDataSource
        Returns the value for the connection property 'trustManagerClass'.
        Specified by:
        getTrustManagerClass in interface ISQLServerDataSource
        Returns:
        trustManagerClass property value
      • setTrustManagerConstructorArg

        public void setTrustManagerConstructorArg​(java.lang.String trustManagerConstructorArg)
        Description copied from interface: ISQLServerDataSource
        Sets Constructor Arguments to be provided on constructor of 'trustManagerClass'.
        Specified by:
        setTrustManagerConstructorArg in interface ISQLServerDataSource
        Parameters:
        trustManagerConstructorArg - 'trustManagerClass' constructor arguments
      • getTrustManagerConstructorArg

        public java.lang.String getTrustManagerConstructorArg()
        Description copied from interface: ISQLServerDataSource
        Returns the value for the connection property 'trustManagerConstructorArg'.
        Specified by:
        getTrustManagerConstructorArg in interface ISQLServerDataSource
        Returns:
        trustManagerConstructorArg property value
      • setURL

        public void setURL​(java.lang.String url)
        Sets the datasource URL.
        Specified by:
        setURL in interface ISQLServerDataSource
        Parameters:
        url - The URL property is exposed for backwards compatibility reasons. Also, several Java Application servers expect a setURL function on the DataSource and set it by default (JBoss and WebLogic) Note for security reasons we do not recommend that customers include the password in the url supplied to setURL. The reason for this is third-party Java Application Servers will very often display the value set to URL property in their DataSource configuration GUI. We recommend instead that clients use the setPassword method to set the password value. The Java Application Servers will not display a password that is set on the DataSource in the configuration GUI. Note if setURL is not called, getURL returns the default value of "jdbc:sqlserver://".
      • getURL

        public java.lang.String getURL()
        Description copied from interface: ISQLServerDataSource
        Returns the URL that is used to connect to the data source.
        Specified by:
        getURL in interface ISQLServerDataSource
        Returns:
        A String that contains the URL.
      • setDescription

        public void setDescription​(java.lang.String description)
        Sets the DataSource description. Per JDBC specification 16.1.1 "...the only property that all DataSource implementations are required to support is the description property".
        Specified by:
        setDescription in interface ISQLServerDataSource
        Parameters:
        description - A String that contains the description.
      • getDescription

        public java.lang.String getDescription()
        Returns the DataSource description
        Specified by:
        getDescription in interface ISQLServerDataSource
        Returns:
        A String that contains the data source description or null if no value is set.
      • setPacketSize

        public void setPacketSize​(int packetSize)
        Sets the packet size.
        Specified by:
        setPacketSize in interface ISQLServerDataSource
        Parameters:
        packetSize - the size (in bytes) to use for the TCP/IP send and receive buffer. It is also the value used for the TDS packet size (SQL Server Network Packet Size). Validity of the value is checked at connect time. If no value is set for this property, its default value is 4KB.
      • getPacketSize

        public int getPacketSize()
        Description copied from interface: ISQLServerDataSource
        Returns the current network packet size used to communicate with SQL Server, specified in bytes.
        Specified by:
        getPacketSize in interface ISQLServerDataSource
        Returns:
        An int value containing the current network packet size.
      • setQueryTimeout

        public void setQueryTimeout​(int queryTimeout)
        Description copied from interface: ISQLServerDataSource
        Setting the query timeout.
        Specified by:
        setQueryTimeout in interface ISQLServerDataSource
        Parameters:
        queryTimeout - The number of seconds to wait before a timeout has occurred on a query. The default value is 0, which means infinite timeout.
      • getQueryTimeout

        public int getQueryTimeout()
        Description copied from interface: ISQLServerDataSource
        Returns the query timeout.
        Specified by:
        getQueryTimeout in interface ISQLServerDataSource
        Returns:
        The number of seconds to wait before a timeout has occurred on a query.
      • setCancelQueryTimeout

        public void setCancelQueryTimeout​(int cancelQueryTimeout)
        Description copied from interface: ISQLServerDataSource
        Sets the cancel timeout.
        Specified by:
        setCancelQueryTimeout in interface ISQLServerDataSource
        Parameters:
        cancelQueryTimeout - The number of seconds to wait before we wait for the query timeout to happen.
      • setEnablePrepareOnFirstPreparedStatementCall

        public void setEnablePrepareOnFirstPreparedStatementCall​(boolean enablePrepareOnFirstPreparedStatementCall)
        Description copied from interface: ISQLServerDataSource
        Sets the value that enables/disables whether the first execution of a prepared statement will call sp_executesql and not prepare a statement. 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. 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 interface ISQLServerDataSource
        Parameters:
        enablePrepareOnFirstPreparedStatementCall - Changes the setting per the description.
      • getEnablePrepareOnFirstPreparedStatementCall

        public boolean getEnablePrepareOnFirstPreparedStatementCall()
        Description copied from interface: ISQLServerDataSource
        Returns the value that indicates whether the first execution of a prepared statement will call sp_executesql and not prepare a statement. 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. 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:
        getEnablePrepareOnFirstPreparedStatementCall in interface ISQLServerDataSource
        Returns:
        Returns the current setting per the description.
      • setServerPreparedStatementDiscardThreshold

        public void setServerPreparedStatementDiscardThreshold​(int serverPreparedStatementDiscardThreshold)
        Description copied from interface: ISQLServerDataSource
        Sets the value that 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 interface ISQLServerDataSource
        Parameters:
        serverPreparedStatementDiscardThreshold - Changes the setting per the description.
      • getServerPreparedStatementDiscardThreshold

        public int getServerPreparedStatementDiscardThreshold()
        Description copied from interface: ISQLServerDataSource
        Returns the value of the setting that 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.
        Specified by:
        getServerPreparedStatementDiscardThreshold in interface ISQLServerDataSource
        Returns:
        Returns the current setting per the description.
      • setStatementPoolingCacheSize

        public void setStatementPoolingCacheSize​(int statementPoolingCacheSize)
        Description copied from interface: ISQLServerDataSource
        Sets the size of the prepared statement cache for this connection. A value less than 1 means no cache.
        Specified by:
        setStatementPoolingCacheSize in interface ISQLServerDataSource
        Parameters:
        statementPoolingCacheSize - Changes the setting per the description.
      • getStatementPoolingCacheSize

        public int getStatementPoolingCacheSize()
        Description copied from interface: ISQLServerDataSource
        Returns the size of the prepared statement cache for this connection. A value less than 1 means no cache.
        Specified by:
        getStatementPoolingCacheSize in interface ISQLServerDataSource
        Returns:
        Returns the current setting per the description.
      • setDisableStatementPooling

        public void setDisableStatementPooling​(boolean disableStatementPooling)
        Description copied from interface: ISQLServerDataSource
        Sets the value to disable/enable statement pooling.
        Specified by:
        setDisableStatementPooling in interface ISQLServerDataSource
        Parameters:
        disableStatementPooling - true to disable statement pooling, false to enable it.
      • setSocketTimeout

        public void setSocketTimeout​(int socketTimeout)
        Description copied from interface: ISQLServerDataSource
        Sets the socket timeout value.
        Specified by:
        setSocketTimeout in interface ISQLServerDataSource
        Parameters:
        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.
      • getSocketTimeout

        public int getSocketTimeout()
        Description copied from interface: ISQLServerDataSource
        Returns the socket timeout value.
        Specified by:
        getSocketTimeout in interface ISQLServerDataSource
        Returns:
        The number of milliseconds to wait before a timeout is occurred on a socket read or accept.
      • setUseBulkCopyForBatchInsert

        public void setUseBulkCopyForBatchInsert​(boolean useBulkCopyForBatchInsert)
        Description copied from interface: ISQLServerDataSource
        Sets whether the use Bulk Copy API should be used for Batch Insert.
        Specified by:
        setUseBulkCopyForBatchInsert in interface ISQLServerDataSource
        Parameters:
        useBulkCopyForBatchInsert - indicates whether Bulk Copy API should be used for Batch Insert operations.
      • getUseBulkCopyForBatchInsert

        public boolean getUseBulkCopyForBatchInsert()
        Description copied from interface: ISQLServerDataSource
        Returns whether the use Bulk Copy API is used for Batch Insert.
        Specified by:
        getUseBulkCopyForBatchInsert in interface ISQLServerDataSource
        Returns:
        whether the driver should use Bulk Copy API for Batch Insert operations.
      • setJASSConfigurationName

        public void setJASSConfigurationName​(java.lang.String configurationName)
        Description copied from interface: ISQLServerDataSource
        Sets the login configuration file for Kerberos authentication. This overrides the default configuration SQLJDBCDriver
        Specified by:
        setJASSConfigurationName in interface ISQLServerDataSource
        Parameters:
        configurationName - the configuration name
      • getReference

        public javax.naming.Reference getReference()
        Specified by:
        getReference in interface javax.naming.Referenceable
      • isWrapperFor

        public boolean isWrapperFor​(java.lang.Class<?> iface)
                             throws java.sql.SQLException
        Specified by:
        isWrapperFor in interface java.sql.Wrapper
        Throws:
        java.sql.SQLException
      • unwrap

        public <T> T unwrap​(java.lang.Class<T> iface)
                     throws java.sql.SQLException
        Specified by:
        unwrap in interface java.sql.Wrapper
        Throws:
        java.sql.SQLException