Connecting to a Data Source 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:
The FILEDSN connection string has the form:
The DSN-less connection string specifies a driver instead of a data source. All connection information must be entered in the connection string because there is no data source storing the information.
The DSN-less connection string has the form:
Table 13-1 gives the long and short names for each attribute, as well as a description. You can specify either long or short names in the connection string. Connection string attribute names are the same as the option names on the driver Setup dialog box tabs unless otherwise noted. The connection string attribute name does not have spaces between the words. For example, the connection string attribute name ApplicationUsingThreads is equivalent to the option name Application Using Threads.
The defaults listed in the table are initial defaults that apply when no value is specified in either the data source definition or in the connection string. If you specified a value for the attribute when configuring the data source, that value is the default.
An example of a DSN connection string with overriding attribute values for Paradox is:
A FILEDSN connection string is similar except for the initial keyword:
A DSN-less connection string must provide all necessary connection information:
DRIVER=DataDirect 5.3 ParadoxFile (*.db);DB=C:\ODBC\EMP
Table 13-1. Paradox Connection String Attributes
|
Attribute
|
Description
|
|
ApplicationUsing Threads (AUT)
|
ApplicationUsingThreads={0 | 1}. Determines whether the driver works with multi-threaded applications.
When set to 1 (the initial default), the driver is thread-safe and is ensured to work with multi-threaded applications.
When using the driver with single-threaded applications, you can set this option to 0 to avoid additional processing required for ODBC thread-safety standards.
|
|
CreateType (CT)
|
CreateType={3 | 4 | 5 | 7 | 8 | 9 | 10 | (null)}. Specifies the database file version for Create Table statements. The numeric values map to the major revision numbers of the Paradox family of products. To override another CreateType setting chosen during data source configuration with the default create type determined by the Level setting in the Paradox section of the IDAPI configuration file, set CreateType= (null).
NOTE: When CreateType is set to 7, 8, 9 or 10, the Paradox driver supports database file names that can be a maximum of 128 characters. For all other CreateType settings, the driver supports database file names of a maximum of eight characters.
|
|
Database (DB)
|
The directory in which the Paradox database files are stored.
For this attribute, you can also specify aliases that are defined in your IDAPI configuration file, if you have one. To do this, enclose the alias name in colons. For example, to use the alias MYDATA, specify "Database=:MYDATA:".
The equivalent Setup dialog box option is Database Directory.
|
|
DataSourceName (DSN)
|
A string that identifies a Paradox data source configuration. Examples include Accounting or Paradox-Serv1.
|
|
DeferQueryEvaluation (DQ)
|
DeferQueryEvaluations={0 | 1}. Determines when a query is evaluated-after all records are read or each time a record is fetched.
When set to 0, the driver generates a result set when the first record is fetched. The driver reads all records, evaluates each one against the Where clause, and compiles a result set containing the records that satisfy the search criteria. This process slows performance when the first record is fetched, but activity performed on the result set after this point is much faster, because the result set has already been created. You do not see any additions, deletions, or changes in the database that occur while working from this result set.
When set to 1 (the initial default), the driver evaluates the query each time a record is fetched, and stops reading through the records when it finds one that matches the search criteria. This setting avoids the slowdown while fetching the first record, but each fetch takes longer because of the evaluation taking place. The data you retrieve reflect the latest changes to the database; however, a result set is still generated if the query is a Union of multiple Select statements, if it contains the Distinct keyword, or if it has an Order By or Group By clause.
|
|
FileOpenCache (FOC)
|
The maximum number of unused file opens to cache. For example, when FileOpenCache=4, and a user opens and closes four database files, the files are not actually closed. The driver keeps them open so that if another query uses one of these database files, the driver does not have to perform another open, which is expensive. The advantage of using file open caching is increased performance. The disadvantage is that a user who tries to open the database file exclusively may get a locking conflict even though no one appears to have the database file open.
The initial default is 0, which means no file open caching.
|
|
IntlSort (IS)
|
IntlSort={0 | 1}. Determines the order in which records are retrieved when you issue a Select statement with an Order By clause.
When set to 0 (the initial default), the driver uses the ASCII sort order. This order sorts items alphabetically with uppercase letters preceding lowercase letters. For example, "A, b, C" is sorted as "A, C, b."
When set to 1, the driver uses the international sort order as defined by your operating system. This order is always alphabetic, regardless of case; the letters from the previous example are sorted as "A, b, C." Refer to your operating system documentation concerning the sorting of accented characters.
The equivalent Setup dialog box option is International Sort.
|
|
NetDir (ND)
|
The directory containing the PARADOX.NET file that corresponds to the database you have specified. If the Paradox database you are using is shared on a network, then every user who accesses it must set this value to point to the same PARADOX.NET file.
If a value is not specified, this value is determined by the NetDir setting in the Paradox section of the IDAPI configuration file. If you are not sure how to set this value, contact your network administrator.
The equivalent Setup dialog box option is Network Directory.
|
|
Passwords (PW)
|
A password or list of passwords. You can add 1 to 50 passwords into the system using a comma-separated list of passwords. Passwords are case-sensitive. For example, Passwords=psw1, psw2, psw3.
|
|
UltraSafeCommit (USF)
|
UltraSafeCommit={0 | 1}. Determines when the driver flushes its changes to disk.
When set to 0, (the initial default), the driver flushes its changes to disk when the database file is closed or when internal buffers are full. In this case, a machine "crash" before closing a database file may cause recent changes to be lost.
When set to 1, the driver flushes its changes to disk at each COMMIT. This decreases performance.
|
|
UseLongQualifiers (ULQ)
|
UseLongQualifiers={0 | 1}. Determines whether the driver uses long path names as database file qualifiers.
When set to 0 (the initial default), the driver does not use long path names as database file qualifiers (the maximum path name length is 128 characters).
When set to 1, the driver uses long path names (the maximum path name length is 255 characters).
|