Connection String Parameters

Advantage OLE DB Provider (for ADO)

  Previous topic Next topic  

 

To connect to this provider, set the Provider argument of the ConnectionString property to either:

 

Advantage OLE DB Provider

or

Advantage.OLEDB.1

 

Reading the Provider property will return the string:

 

Advantage.OLEDB.1

Typical Connection String

A typical connection string for a free connection for the Advantage OLE DB Provider may look something like:

 

"Provider=Advantage OLE DB Provider; Data Source=x:\data"

 

A typical connection string for a database connection for the Advantage OLE DB Provider may look something like:

 

"Provider=Advantage OLE DB Provider; Data Source=x:\data\MyDatabase.add; User ID=EmersonB; Password=joshua;"

 

Consisting of these keywords:

Keyword

Description

Provider

Specifies the Advantage OLE DB Provider.

Data Source

The fully qualified path to the computer where the data files exist and the default location of the data files. This fully qualified path must contain a drive letter or use UNC. The Data Source must be specified before a successful connection to an Advantage server can occur. If a Free Connection is desired, the Data Source must specify a directory location. For a Database Connection, the path and data dictionary file can be specified in the Data Source property (e.g., Data Source=\\myserver\myvolume\mypat\mydd.add). Or the Data Source can contain just the path, and the Initial Catalog property can contain the data dictionary name (e.g., Data Source=\\myserver\myvolume\mypath; Initial Catalog=mydd.add).

Initial Catalog

The name of the data dictionary to use when creating a Database Connection to an Advantage server. It is not necessary to specify the initial catalog. The full path to the Advantage Data Dictionary can also be specified in the Data Source property if desired.

User ID

Indicates the user name to use when making a Database Connection to an Advantage server. Note that if this property is supplied, Advantage assumes that a Database Connection is being attempted. If a Free Connection is desired, do not supply this property.

Password

Indicates the password to use in conjunction with the User ID when making a Database Connection to an Advantage server.

 

Provider-Specific Connection Parameters

The Advantage OLE DB Provider supports several provider-specific connection parameters in addition to those defined by ADO. As with all other connection parameters, they can be set via the Connection object's Properties collection or as part of the connection string. Note that all of the valid values listed below, such as ADS_REMOTE_SERVER and ADS_LOCAL_SERVER, must be specified as the literal values as written. These values are not constants that represent some integer value. Available provider-specific connection parameters are:

 

Parameter

Description

TableType

Specifies the desired table type. Valid values include ADS_ADT, ADS_CDX, ADS_VFP, and ADS_NTX. The default is ADS_ADT.

Note When opening tables (directly or via SQL statements) on a database connection, this property is ignored, as the table type is stored in the data dictionary for database tables. When creating tables (on either a database connection or a free connection), this property is obeyed to know which table type to create.

Note To get support for creating and opening DBF/DBT/NTX files directly or via SQL statements, create a database (defined in a data dictionary) and add the tables and the associated NTX index files to that database. Then use those tables on that database connection. The NTX index files will then get automatically opened when the corresponding DBF table is opened. You can use the Advantage Data Architect to create a database and data dictionary. It is possible to access tables with the ADS_NTX table type on free connections, however Advantage will not open any of the associated index files. Thus, any updates made to tables opened with the ADS_NTX table type on free connections would logically corrupt the NTX indexes.

ServerType

Specifies the Advantage server types to which connections should be attempted. Valid values include ADS_REMOTE_SERVER, ADS_LOCAL_SERVER, and ADS_AIS_SERVER. These values can be logically OR’ed together with the vertical bar character "|" in order to choose multiple server types. The default is ADS_REMOTE_SERVER. If multiple types are specified and multiple server types are available, the order of precedence is ADS_REMOTE_SERVER first, ADS_AIS_SERVER second, and ADS_LOCAL_SERVER last.

SecurityMode

Specifies the security mode to use. Valid values include ADS_CHECKRIGHTS and ADS_IGNORERIGHTS. The default is ADS_CHECKRIGHTS. Note: this property is ignored when obtaining a database connection. User Access Control security is implemented into the data dictionary.

Beginning with version 10.0, the client no longer performs rights checking by default. See Check Rights.

EncryptionPassword

Specifies the encryption password to use with all tables on Free Connections that are opened directly (adCmdTableDirect). The encryption password will consist of the first twenty characters specified after the equals sign following the EncryptionPassword key word. If using less than a twenty-letter password, a semi-colon should be included directly after the password so the Advantage OLE DB Provider knows when the password ends. For Database Connections (see Data Source), this property is not used. Database Connections should use the User ID and Password properties. Note: This parameter only affects direct table opens (adCmdTableDirect). To use encrypted tables with SQL, use a Database Connection.

LockMode

Specifies the locking mode to use with DBF tables. Valid values include ADS_PROPRIETARY_LOCKING and ADS_COMPATIBLE_LOCKING. This setting is applicable to the ADS_CDX, ADS_VFP, and ADS_NTX TableType options. If set to ADS_PROPRIETARY_LOCKING, Advantage’s high-performance internal locking mode is used. If set to ADS_COMPATIBLE_LOCKING, DBF tables can be shared in a writable mode with non-Advantage database applications. The default is ADS_PROPRIETARY_LOCKING.

ShowDeleted

Specifies whether deleted records in DBF tables are visible. Valid values are TRUE or FALSE. This setting is applicable to the ADS_CDX, ADS_VFP, and ADS_NTX TableType options. If set to TRUE, deleted records in the DBF table will be visible. The default is FALSE.

DbfsUseNulls

Specifies whether DBF tables are to return NULL for column data that is ordinarily considered as "empty" in Xbase terminology. Valid values are TRUE or FALSE. This setting is applicable to the ADS_CDX, ADS_VFP, and ADS_NTX TableType options. If set to TRUE, "empty" column values in DBF tables will be returned as NULL. If set to FALSE, "empty" column values in DBF tables will be returned as actual valid data. The default is FALSE.

CharType

Specifies whether the data in DBF tables is ANSI or OEM. Valid values include ADS_ANSI and ADS_OEM. This setting is applicable to the ADS_CDX, ADS_VFP, and ADS_NTX TableType options. The default is ADS_ANSI. When using ADS_ADT and ADS_VFP tables, the value can also be one of the dynamically loaded collations.

TrimTrailingSpaces

Specifies whether trailing white space is removed from string fields when the data is retrieved. Valid values are TRUE or FALSE. If TRUE is specified, then fields of type DBTYPE_STR will have trailing white spaced trimmed on retrieval. Note that the Advantage data types ADS_STRING and ADS_MEMO are both mapped to DBTYPE_STR. If FALSE is specified, then trailing white space is maintained on the values when they are retrieved. This means that a fixed length field (ADS_STRING) with a width of 10, for example, will always return 10 characters when the value is retrieved; it is padded with as many spaces as necessary. It may be desirable to specify TRUE to trim trailing blanks if, for example, an application is using the ADO Find method. If trailing blanks are not trimmed, then search values given to the Find method would have to be padded to the full field length in order for the search to succeed. The default is FALSE

FilterOptions

Specifies whether to respect the filtering applied to the rowset when determining record count and logical positioning information. Valid values are IGNORE_WHEN_COUNTING and RESPECT_WHEN_COUNTING. When using RESPECT_WHEN_COUNTING, the record count and scroll bar positioning will be accurate but with a potential speed tradeoff. In some cases, the provider may have to skip through all records in the rowset to determine the count and position. It is not recommended to use the RESPECT_WHEN_COUNTING option except on very small rowsets. When a rowset is to be opened and displayed in a data bound grid, the grid requests record count information from the provider to position the scroll bar. Because it can request this information several times for any movement in the grid, it is usually best if the IGNORE_WHEN_COUNTING option is used in order for the grid to be more responsive. If you use the ADO RecordSet property .RecordCount and need a completely accurate count, then use the RESPECT_WHEN_COUNTING option. All record count requests are sent to the same OLE DB interface, so it is not possible for it to know implicitly how accurate the count should be for a given call. The default is IGNORE_WHEN_COUNTING.

IncrementUsercount

Specifies whether to increment the user count on the Advantage Database Server for each new connection to the Advantage Database Server. Valid values are TRUE and FALSE. With a value of FALSE, if the same PC connects to the Advantage Database Server more than one time the connections are counted as a single user and only the connection count is incremented. With a value of TRUE, each connection counts as a new user on the Advantage Database Server. This property allows an Advantage middleware type of application to increment the Advantage Database Server user count for each remote client workstation indirectly accessing the Advantage Database Server. This provides an easy way for Advantage middleware applications to abide by the Advantage Database Server license agreement as related to remote client workstations taking up a "user" toward the maximum number of licensed users. The default is FALSE.

StoredProcedureConnection

Specifies if this connection lives within a stored procedure executed on the behalf of remote clients. Valid values are TRUE and FALSE. If this property is set to TRUE, the application will not increment the server user count for the stored procedure. If it is FALSE, then the stored procedure will increment the server user count, which will prevent other users from connecting when the user count reaches the maximum. The default is FALSE. Connections to Advantage Local Server are not affected by this property.

Compression

Specifies the option for communications compression Valid values are INTERNET, ALWAYS, and NEVER. If INTERNET is specified, then all data communications for ADS_AIS_SERVER connections will be compressed unless compression is specifically turned off at the server. If ALWAYS is specified, then all data communications between the client and server will be compressed unless compression is specifically turned off at the server. If NEVER is specified, then compression will not be used for communications between the client and server. If this property is not specified, then the COMPRESSION setting in the ADS.INI file will be used if available. This property is ignored for ADS_LOCAL_SERVER connections.

CommType

Specifies the communication protocol used to connect to the Advantage Database Server. Valid values are UDP_IP, IPX, and TCP_IP. If UDP_IP is specified, the client will only use UDP/IP to communicate with the Advantage Database Server. If IPX is specified, the client will only use IPX to communicate with the Advantage Database Server. If TCP_IP is specified, the client will only use TCP/IP to communicate with the Advantage Database Server.

 

For example, to specify that the provider is to use Advantage Local Server and FoxPro-compatible tables for a free connection, you could use the ADO connection string specified below. Note the provider name can be specified by either its friendly name, Advantage OLE DB Provider, or by its official registry name, Advantage.OLEDB.1:

"Provider=Advantage OLE DB Provider; Data Source=z:\data\tables; ServerType=ADS_LOCAL_SERVER; TableType=ADS_CDX;"