19 The XML 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” and Table 19-2 and Table 19-3 for an alphabetical list of driver connection string attributes and their initial default values.
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.
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 an XML data source:
1
User DSN: If you are configuring an existing user data source, select the data source name on the User DSN tab and click Configure to display the driver Setup dialog box.
If you are configuring a new user data source, click Add on the User DSN tab to display a list of installed drivers. Select the driver and click Finish to display the driver Setup dialog box.
System DSN: To configure a new system data source, click Add on the System DSN tab 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 name on the File DSN tab and click Configure to display the driver Setup dialog box.
If you are configuring a new file data source, click Add on the File DSN tab to display a list of installed drivers. Select the driver and click Next. 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 XML 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.
2
3
4
If you want to define a location, click Add. The Configure Location dialog box appears.
The General tab of the Configure Location dialog box for XML
5
Location: Either type the full path to the location you are defining or click the select button:
Select button
to select a path.
6
Optionally, click the Advanced tab of the Configure Location dialog box to specify additional information about the location you are defining.
The Advanced tab of the Configure Location dialog box
On this tab, provide any of the following optional information; then, click Apply.
7
You can click Test Connect to attempt to connect to the location.
If the driver cannot connect because of an incorrect environment or connection value, it displays an appropriate error message. Click OK.
8
Click OK to return to the ODBC XML driver Setup dialog box or Cancel. If you click OK, the values you have specified become the defaults for this location.
9
Optionally, click the Advanced tab of the ODBC XML driver Setup dialog box to specify data source settings.
The Advanced tab of the ODBC XML Driver Setup dialog box
On this tab, provide any of the following optional information; then, click Apply.
10
Optionally, click the Options tab to specify data source connection values.
The Options tab of the ODBC XML Driver Setup dialog box
Driver Options: Type configuration options specific to the XML driver.
WARNING: The properties you set in the Options tab override other properties for this session only and can adversely affect the operation of the XML driver. Use only authorized entries. For information about authorized entries for the Options tab, contact Progress DataDirect customer support.
11
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 logon dialog box appears (see “Using a Logon Dialog Box” for details). Note that the information you enter in the logon 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.
12
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 19-2 and Table 19-3 give the names and descriptions of the attributes, as well as the initial default value when the driver is first installed.
An example of a DSN connection string with overriding attribute values for XML is:
DSN=XML FILES;LOC1.Create Type=ADO25;Logging=1
A FILEDSN connection string is similar except for the initial keyword:
FILEDSN=XML.dsn;LOC1.Create Type=ADO25;Logging=1
A DSN-less connection string must provide all necessary connection information:
DRIVER=DataDirect 7.0 XML;LOC1={DataDirect Closed XML ADO Provider}
Using a Logon Dialog Box
Some ODBC applications display a Logon dialog box when you are connecting to a data source. For XML, the dialog box is as follows:
The ODBC XML Driver Connection dialog box
This dialog box appears for each password-protected location that you have defined for the data source.
In this dialog box, provide the following information:
1
2
Click OK to connect to the data source.