sqljdbc JDBC Driver Connection Properties and Defaults

Q

What is connection properties are supported by sqljdbc JDBC Driver? What are their default property values?

✍: FYIcenter.com

A

Connection properties supported by sqljdbc JDBC driver and property default values are listed below:

  • serverName, server - The computer running SQL Server.
  • portNumber, port - The port where SQL Server is listening. If the port number is specified in the connection string, no request to sqlbrowser is made. When the port and instanceName are both specified, the connection is made to the specified port. However, the instanceName is validated and an error is thrown if it does not match the port.
  • instanceName - The SQL Server instance name to connect to. When it is not specified, a connection is made to the default instance. For the case where both the instanceName and port are specified, see the notes for port. Another option is to append instance name for the host name like "<host_name>\<instance_name>".
  • databaseName, database - The name of the database to connect to. If not stated, a connection is made to the default database. Note that a single database server can serve multiple databases, and one of them will be flagged as the default database.
  • userName, user - The database user.
  • password - The database password.
  • accessToken - Use this property to connect to a SQL database using an access token. accessToken can only be set using the Properties parameter of the Connect method in the DriverManager class. It cannot be used in the connection URL.
  • applicationIntent - Declares the application workload type when connecting to a server. Possible values are ReadOnly and ReadWrite. For more information, see JDBC Driver Support for High Availability, Disaster Recovery.
  • applicationName - The application name, or "Microsoft JDBC Driver for SQL Server" if no name is provided. Used to identify the specific application in various SQL Server profiling and logging tools.
  • authentication - Beginning with Microsoft JDBC Driver 6.0 for SQL Server, this optional property indicates which SQL authentication method to use for connection. Possible values are ActiveDirectoryIntegrated, ActiveDirectoryPassword, SqlPassword and the default NotSpecified.
  • authenticationScheme - Indicates which kind of integrated security you want your application to use. Possible values are JavaKerberos and the default NativeAuthentication.
  • columnEncryptionSetting - Set to "Enabled" to use the Always Encrypted (AE) feature beginning with Microsoft JDBC Driver 6.0 for SQL Server. When AE is enabled, the JDBC driver transparently encrypts and decrypts sensitive data stored in encrypted database columns in the SQL Server.
  • disableStatementPooling - Only the value "true" is currently supported. If set to "false", an exception will occur.
  • encrypt - Set to "true" to specify that the SQL Server uses Secure Sockets Layer (SSL) encryption for all the data sent between the client and the server if the server has a certificate installed. The default value is false.
  • failoverPartner - The name of the failover server used in a database mirroring configuration. This property is used for an initial connection failure to the principal server; after you make the initial connection, this property is ignored. Must be used in conjunction with databaseName property.
  • hostNameInCertificate - The host name to be used in validating the SQL Server SSL certificate.
  • integratedSecurity - Set to "true" to indicate that Windows credentials will be used by SQL Server to authenticate the user of the application. If "true," the JDBC driver searches the local computer credential cache for credentials that have already been provided at the computer or network logon. If "false," the username and password must be supplied.
  • keyStoreAuthentication - Beginning with Microsoft JDBC Driver 6.0 for SQL Server, this property identifies which key store to seamlessly set up for the connection with Always Encrypted and determines an authentication mechanism used to authenticate to the key store. Microsoft JDBC Driver 6.0 for SQL Server supports setting up of the Java Key Store seamlessly using this property for which you need to set "keyStoreAuthentication=JavaKeyStorePassword". Note that to use this property, you also need to set the keyStoreLocation and keyStoreSecret properties for the Java Key Store.
  • keyStoreLocation - When keyStoreAuthentication=JavaKeyStorePassword, the keyStoreLocation property identifies the path to the Java keystore file that stores the column master key to be used with Always Encrypted data. Note that the path must include the keystore filename.
  • keyStoreSecret - When keyStoreAuthentication=JavaKeyStorePassword, the keyStoreSecret property identifies the password to use for the keystore as well as for the key. Note that for using the Java Key Store the keystore and the key password must be the same.
  • lastUpdateCount - A "true" value only returns the last update count from an SQL statement passed to the server, and it can be used on single SELECT, INSERT, or DELETE statements to ignore additional update counts caused by server triggers. Setting this property to "false" causes all update counts to be returned, including those returned by server triggers.
  • lockTimeout - The number of milliseconds to wait before the database reports a lock time-out. The default behavior is to wait indefinitely. If it is specified, this value is the default for all statements on the connection. Note that Statement.setQueryTimeout() can be used to set the time-out for specific statements. The value can be 0, which specifies no wait.
  • loginTimeout - The number of seconds the driver should wait before timing out a failed connection. A zero value indicates that the timeout is the default system timeout, which is specified as 15 seconds by default. A non-zero value is the number of seconds the driver should wait before timing out a failed connection.
  • multiSubnetFailover - Always specify multiSubnetFailover=true when connecting to the availability group listener of a SQL Server 2012 availability group or a SQL Server 2012 Failover Cluster Instance. multiSubnetFailover=true configures Microsoft JDBC Driver for SQL Server to provide faster detection of and connection to the (currently) active server. Possible values are true and false. See JDBC Driver Support for High Availability, Disaster Recovery for more information.
  • packetSize - The network packet size used to communicate with SQL Server, specified in bytes. A value of -1 indicates using the server default packet size. A value of 0 indicates using the maximum value, which is 32767. If this property is set to a value outside the acceptable range, an exception will occur.
  • responseBuffering - If this property is set to "adaptive", the minimum possible data is buffered when necessary. The default mode is "adaptive".
  • selectMethod - If this property is set to "cursor," a database cursor is created for each query created on the connection for TYPE_FORWARD_ONLY and CONCUR_READ_ONLY cursors. This property is typically required only if the application generates very large result sets that cannot be fully contained in client memory. When this property is set to "cursor," only a limited number of result set rows are retained in client memory. The default behavior is that all result set rows are retained in client memory. This behavior provides the fastest performance when the application is processing all rows.
  • sendStringParametersAsUnicode - If the sendStringParametersAsUnicode property is set to "true", String parameters are sent to the server in Unicode format.
  • sendTimeAsDatetime - This property was added in SQL Server JDBC Driver 3.0. When true, java.sql.Time values will be sent to the server as SQL Serverdatetime values. When false, java.sql.Time values will be sent to the server as SQL Servertime values.
  • serverSpn - Beginning in Microsoft JDBC Driver 4.2 for SQL Server, this optional property can be used to specify the Service Principal Name (SPN) for a Java Kerberos connection. It is used in conjunction with authenticationScheme.
  • serverNameAsACE - Beginning with Microsoft JDBC Driver 6.0 for SQL Server, set to "true" to indicate that the driver should translate the Unicode server name to ASCII compatible encoding (Punycode) for the connection. If this setting is false, the driver connects using the server name as provided by the user.
  • columnEncryptionSetting - Set to "true" to use the Always Encrypted (AE) feature beginning with Microsoft JDBC Driver 6.0 for SQL Server. When AE is enabled, the JDBC driver transparently encrypts and decrypts sensitive data stored in encrypted database columns in the SQL Server.
  • trustServerCertificate - Set to "true" to specify that the Microsoft JDBC Driver for SQL Server will not validate the SQL Server SSL certificate.
  • trustStore - The path (including filename) to the certificate trustStore file. The trustStore file contains the list of certificates that the client trusts.
  • trustStorePassword - The password used to check the integrity of the trustStore data.
  • workstationID - The workstation ID. Used to identify the specific workstation in various SQL Server profiling and logging tools. If none is specified, the <empty string> is used.
  • xopenStates - Set to "true" to specify that the driver returns XOPEN-compliant state codes in exceptions. The default is to return SQL 99 state codes.

 

SQL Server SQLEXPRESS Service for sqljdbc Test

sqljdbc JDBC Driver Connection URL String

Examples for sqljdbc - JDBC Driver for SQL Server

⇑⇑ FAQ for sqljdbc - JDBC Driver for SQL Server

2017-01-05, 2599🔥, 0💬