7.7.3.Initialization Properties
When the consumer calls IDBInitialize::Initialize, the OpenLink Provider calls the UDBC/ODBC functions SQLSetConnectOption, to set various connection options, and SQLDriverConnect, to connect to an ODBC data source. The values passed to SQLSetConnectOption and SQLDriverConnect come from the initialization properties set by the consumer.
When the data source object is first created, the value of each initialization property is set to a default value.
Initialization Properties Used
The following lists the initialization properties currently used by the OpenLink Provider. Any properties not listed are not used by the OpenLink Provider.
Table7.3.OLE-DB Initialization Properties
| Property | Description |
|---|---|
| DBPROP_AUTH_PASSWORD | Passed as the value of the PWD keyword in SQLDriverConnect. |
| DBPROP_AUTH_USERID | Passed as the value of the UID keyword in SQLDriverConnect. |
| DBPROP_INIT_CATALOG | Sets the initial catalog for data sources which recognise catalogs. |
| DBPROP_INIT_DATASOURCE | Passed as the value of the DSN keyword in SQLDriverConnect. |
|
DBPROP_INIT_HWND |
Passed as the value of the hwnd argument in SQLDriverConnect. |
|
DBPROP_INIT_MODE |
Mapped to the ODBC connect option SQL_ACCESS_MODE. |
|
DBPROP_INIT_PROMPT |
Passed as the value of the fDriverCompletion parameter in SQLDriverConnect. |
| DBPROP_INIT_PROVIDERSTRING | Specifies extended properties for controlling ODBC Cursor Library usage (through the 'Cursors' keyword) and the whether bookmarks are exposed by default on rowsets (through the 'BookmarkDefault' keyword). |
| DBPROP_INIT_TIMEOUT | Mapped to the ODBC connect option SQL_LOGIN_TIMEOUT. |
Setting and Getting Provider Properties
The data source object is the first object created when a consumer instantiates the provider by calling CoCreateInstance.
The data source object provides the starting point for communications between the provider and consumer. For example, a consumer can call CoCreateInstance and request an IDBInitialize interface pointer to instantiate a data source object. The provider has a CLSID (class ID) that is stored in the Windows Registry. The consumer can use this CLSID with CoCreateInstance to instantiate the data source object. The OpenLink provider setup program registers the OpenLink provider in the Windows Registry.
The data source object is responsible for setting and returning information about the properties supported by the provider and exposing the list of supported keywords and literals. This functionality is supported through the mandatory IDBProperties interface and the optional IDBInfo interface. The IDBProperties interface contains three methods:
-
GetProperties returns the list of properties currently set on the data source object.
-
GetPropertyInfo returns information about supported rowset and data source properties.
-
SetProperties sets the properties on the data source object.
The IDBInfo interface contains two methods:
-
GetKeywords returns a list of supported keywords.
-
GetLiteralInfo returns information about literals used in text commands.