Connection String Properties


You can use the following connection properties with the JDBC driver manager or SQL Server 2000 Driver for JDBC data sources.

Table 3-1 lists the JDBC connection properties supported by the SQL Server driver, and describes each property. The properties have the form:

property=value 

NOTE: All connection string property names are case-insensitive. For example, PortNumber is the same as portnumber.

Table 3-1. SQL Server Connection String Properties 
Property
Description
DatabaseName
OPTIONAL
The name of the SQL Server database to which you want to connect.
HostProcess
OPTIONAL
The process ID of the application connecting to SQL Server 2000. The supplied value appears in the "hostprocess" column of the sysprocesses table.
NetAddress
OPTIONAL
The MAC address of the network interface card of the application connecting to SQL Server 2000. The supplied value appears in the "net_address" column of the sysprocesses table.
Password
The case-insensitive password used to connect to your SQL Server database.
PortNumber
OPTIONAL
The TCP port (use for DataSource connections only). The default is 1433.
ProgramName
OPTIONAL
The name of the application connecting to SQL Server 2000. The supplied value appears in the "program_name" column of the sysprocesses table.
SelectMethod
SelectMethod={cursor | direct}. Determines whether database cursors are used for Select statements. Performance and behavior of the driver are affected by the SelectMethod setting.
SelectMethod (cont.)
Direct-The direct method sends the complete result set in one request to the driver. It is useful for queries that only produce a small amount of data that you fetch completely. You should avoid using direct when executing queries that produce a large amount of data, as the result set is cached completely on the client and constrains memory. In this mode, each statement requires its own connection to the database. This is accomplished by "cloning" connections. Cloned connections use the same connection properties as the original connection; however, because transactions must occur on a single connection, auto commit mode is required. Due to this, JTA is not supported in direct mode. In addition, some operations, such as updating an insensitive result set, are not supported in direct mode because the driver must create a second statement internally. Exceptions generated due to the creation of cloned statements usually return an error message similar to "Cannot start a cloned connection while in manual transaction mode."
Cursor-When the SelectMethod is set to cursor, a server-side cursor is generated. The rows are fetched from the server in blocks. The JDBC Statement method setFetchSize can be used to control the number of rows that are fetched per request. The cursor method is useful for queries that produce a large amount of data, data that is too large to cache on the client. Performance tests show that the value of setFetchSize has a serious impact on performance when SelectMethod is set to cursor. There is no simple rule for determining the value that you should use. You should experiment with different setFetchSize values to find out which value gives the best performance for your application.
The default is direct.
SendStringParameters
AsUnicode
SendStringParametersAsUnicode={true | false}. Determines whether string parameters are sent to the SQL Server database in Unicode or in the default character encoding of the database. True means that string parameters are sent to SQL Server in Unicode. False means that they are sent in the default encoding, which can improve performance because the server does not need to convert Unicode characters to the default encoding. You should, however, use default encoding only if the parameter string data that you specify is consistent with the default encoding of the database.
The default is true.
ServerName
The IP address (use for DataSource connections only).
User
The case-insensitive user name used to connect to your SQL Server database.


Previous Document Previous Page Next Document Next Page Synchronize TOC Synchronize with Contents