14 The SQL Server Legacy Wire Protocol Driver : Configuring and Connecting to Data Sources

Configuring and Connecting to Data Sources
After you install the driver, you configure data sources to connect to the database. See Chapter 1 “Quick Start Connect” for an explanation of different types of data sources. The data source contains connection options that allow you to tune the driver for specific performance. If you want to use a data source but need to change some of its values, you can either modify the data source or override its values at connection time through a connection string.
If you choose to use a connection string, you must use specific connection string attributes. See “Using a Connection String”, Table 14-1, and Table 14-2 for an alphabetical list of driver connection string attributes and their initial default values.
Data Source Configuration in the UNIX/Linux odbc.ini File
On UNIX and Linux, you must set up the proper ODBC environment before configuring data sources. See “Environment Configuration” for basic setup information and “Environment Variables” for more detail about this procedure.
Data sources for UNIX and Linux are stored in the system information file (by default, odbc.ini). If you have a Motif GUI environment on Linux, you can configure and modify data sources through the DataDirect ODBC Data Source Administrator for Linux (the Linux ODBC Administrator) using a driver Setup dialog box. (See “Configuration Through the Administrator” for a detailed explanation of the Administrator.)
If you do not have a GUI environment, you can configure and modify data sources directly by editing the odbc.ini file and storing default connection values there. See “Configuration Through the System Information (odbc.ini) File” for detailed information about the specific steps necessary to configure a data source.
Each of Table 14-1 and Table 14-2 lists driver connection string attributes that must be used in the odbc.ini file to set the value of the attributes. Note that only the long name of the attribute can be used in the file. The default listed in the table is the initial default value when the driver is installed.
Data Source Configuration through a GUI
On Windows, data sources are stored in the Windows Registry. You can configure and modify data sources through the ODBC Administrator using a driver Setup dialog box, as described in this section.
On UNIX and Linux, data sources are stored in the odbc.ini file. On Linux, you can configure and modify data sources through the Linux ODBC Administrator using a driver Setup dialog box, as described in this section.
NOTE: This book shows dialog box images that are specific to Windows. If you are using the drivers in the Linux environment, the dialog box that you see may differ slightly from the Windows version. Windows-only and UNIX-only connection options are specifically noted by icons in the Setup dialog box descriptions.
When the driver is first installed, the values of its connection options are set by default. These values appear on the driver Setup dialog box tabs when you create a new data source. You can change these default values by modifying the data source. In the following procedure, the description of each tab is followed by a table that lists the connection options for that tab and their initial default values. This table links you to a complete description of the options and their connection string attribute equivalents. The connection string attributes are used to override the default values of the data source if you want to change these values at connection time.
To configure a Microsoft SQL Server data source:
1
On Linux, change to the install_dir/tools directory and, at a command prompt, enter:
odbcadmin
where install_dir is the path to the product installation directory.
2
User DSN: If you are configuring an existing user data source, select the data source name and click Configure to display the driver Setup dialog box.
If you are configuring a new user data source, click Add to display a list of installed drivers. Select the driver and click Finish to display the driver Setup dialog box.
System DSN: If you are configuring an existing system data source, select the data source name and click Configure to display the driver Setup dialog box.
If you are configuring a new system data source, click Add to display a list of installed drivers. Select the driver and click Finish to display the driver Setup dialog box.
File DSN: If you are configuring an existing file data source, select the data source file and click Configure to display the driver Setup dialog box.
If you are configuring a new file data source, click Add to display a list of installed drivers; then, select a driver. Click Advanced if you want to specify attributes; otherwise, click Next to proceed. Specify a name for the data source and click Next. Verify the data source information; then, click Finish to display the driver Setup dialog box.
The General tab of the Setup dialog box appears by default.
The General tab of the ODBC SQL Server Legacy Wire Protocol Driver Setup dialog box
NOTE: The General tab displays only fields that are required for creating a data source. The fields on all other tabs are optional, unless noted otherwise.
3
On this tab, provide values for the options in the following table; then, click Apply. The table provides links to descriptions of the connection options.
4
Optionally, click the Advanced tab to specify additional data source settings.
The Advanced tab of the ODBC SQL Server Legacy Wire Protocol Driver Setup dialog box
On this tab, provide values for any of the options in the following table; then, click Apply. The table provides links to descriptions of the connection options.
Translate: Click Translate to display the Select Translator dialog box, which lists the translators specified in the ODBC Translators section of the Registry. Progress DataDirect provides a translator named OEM to ANSI that translates your data from the IBM PC character set to the ANSI character set.
Select a translator; then, click OK to close this dialog box.
5
Optionally, click the Failover tab to specify failover data source settings. This tab is available only on UNIX and Linux.
See “Using Failover” for a general description of failover and its related connection options.
On this tab, provide values for any of the options in the following table; then, click Apply. The table provides links to descriptions of the connection options.
6
At any point during the configuration process, you can click Test Connect to attempt to connect to the data source using the connection options specified in the driver Setup dialog box. A Login dialog box appears; see “Using a Connection String” for details. Note that the information you enter in the Login dialog box during a test connect is not saved.
If the driver cannot connect because of an incorrect environment or connection value, it displays an appropriate error message. Click OK.
7
Click OK or Cancel. If you click OK, the values you have specified become the defaults when you connect to the data source. You can change these defaults by using this procedure to reconfigure your data source. You can override these defaults by connecting to the data source using a connection string with alternate values.
Using a Connection String
If you want to use a connection string for connecting to a database, or if your application requires it, you must specify either a DSN (data source name), a File DSN, or a DSN-less connection in the string. The difference is whether you use the DSN=, FILEDSN=, or the DRIVER= keyword in the connection string, as described in the ODBC specification. A DSN or FILEDSN connection string tells the driver where to find the default connection information. Optionally, you may specify attribute=value pairs in the connection string to override the default values stored in the data source.
The DSN connection string has the form:
DSN=data_source_name[;attribute=value[;attribute=value]...]
The FILEDSN connection string has the form:
FILEDSN=filename.dsn[;attribute=value[;attribute=value]...]
The DSN-less connection string specifies a driver instead of a data source. All connection information must be entered in the connection string because the information is not stored in a data source.
The DSN-less connection string has the form:
DRIVER=[{]driver_name[}][;attribute=value[;attribute=value]...]
Table 14-1 and Table 14-2 list the long and short names for each attribute, as well as the initial default value when the driver is first installed. You can specify either long or short names in the connection string.
An example of a DSN connection string with overriding attribute values for Microsoft SQL Server is:
DSN=ACCOUNTING;DATABASE=ACCT
A FILEDSN connection string is similar except for the initial keyword:
FILEDSN=SQLServer.dsn;DATABASE=ACCT
A DSN-less connection string must provide all necessary connection information:
DRIVER=DataDirect 7.0 SQL Server Legacy Wire Protocol;
DATABASE=ACCT;SERVER=SQL2;UID=JOHN;PWD=XYZZY
The connection string attribute names are case-sensitive.
Using a Login Dialog Box
Some ODBC applications display a Login dialog box when you are connecting to a data source. In these cases, the data source name has already been specified.
The SQL Server Legacy Wire Protocol Login dialog box
In the Login dialog box, provide the following information:
1
Type an IP address in Server in the following format: IP_address, port_number. For example, you can enter 199.226.224.34,5000. If your network supports named servers, you can specify an address as: server_name, port_number. For example, you can enter SSserver,5000.
The IP address can be specified in IPv4 on Windows, and in either IPv4 or IPv6 format, or a combination of the two, on UNIX. See “Using IP Addresses” for details about these formats.
To specify a named instance of Microsoft SQL Server, use the format: server_name\instance_name. If only a server name is specified with no instance name, the driver uses the default named instance on the server.
Type the name of a server on your network. It must be an entry on the Alias tab of the SQL Server Network Client Utility or the network name of a server running Microsoft SQL Server.
You can enter (local) when the driver is on the same computer as the Microsoft SQL Server database. You can connect to a local copy of Microsoft SQL Server, even when it is a non-networked version. Microsoft SQL Server 2000 and higher support multiple instances of Microsoft SQL Server running on the same computer.
2
Select the Use Trusted Connection check box to specify that the SQL Server Legacy Wire Protocol driver request a secure (or trusted) connection to Microsoft SQL Server. SQL Server uses integrated login security to establish connections using this data source, regardless of the current login security mode at the server. Any login ID or password supplied is ignored. The Microsoft SQL Server system administrator must have associated your Windows network ID with a Microsoft SQL Server login ID.
Clear this box to specify that Microsoft SQL Server use standard login security to establish connections using this data source. You must specify a login ID and password for all connection requests.
3
Type the Microsoft SQL Server login ID to use for the connection if Use Trusted Connection is not selected. If Use Trusted Connection is selected, the Login ID field is disabled.
4
Type the password to use for the connection if Use Trusted Connection is not selected. If Use Trusted Connection is selected, the Password field is disabled.
5
Type the name of the database to which you want to connect. If you do not specify a value, the default database defined by Microsoft SQL Server is used.
6
Click OK to log on to the Microsoft SQL Server database installed on the server you specified and to update the values in the Registry.