How To Use IDataInitialize and Connection String Properties (252348)



The information in this article applies to:

  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.6

This article was previously published under Q252348

SUMMARY

The IDataInitialize interface can be used to connect to an OLE DB datasource by using a connection string. The IDataInitialize interface is supplied by the OLE DB core components.

When writing an OLE DB provider, it is important for you to know that the IDataInitialize interface looks for certain default OLE DB properties in the connection string and then verifies that the provider supports them.

If the provider does not support default OLE DB properties in the connection string, then the IDataInitialize::GetDataSource() method returns DB_E_ERRORSOCCURRED.

MORE INFORMATION

The IDataInitialize interface checks the properties returned from the provider's IDBProperties::GetProperties() method.

The specific properties that the IDataInitialize::GetDataSource() method checks for in OLE DB 2.1 are:
Cache Authentication    DBPROP_AUTH_CACHE_AUTHINFO
Encrypt Password        DBPROP_AUTH_ENCRYPT_PASSWORD
Integrated Security     DBPROP_AUTH_INTEGRATED
Mask Password           DBPROP_AUTH_MASK_PASSWORD
Password                DBPROP_AUTH_PASSWORD
Persist Encrypted       DBPROP_AUTH_PERSIST_ENCRYPTED 
Persist Security Info   DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO 
User ID	               DBPROP_AUTH_USERID 
Asynchronous Processing DBPROP_INIT_ASYNCH 
Bind Flags              DBPROP_INIT_BINDFLAGS 
Data Source             DBPROP_INIT_DATASOURCE 

Window Handle           DBPROP_INIT_HWND 
Impersonation Level     DBPROP_INIT_IMPERSONATION_LEVEL
Local Identifier        DBPROP_INIT_LCID			
Location                DBPROP_INIT_LOCATION			
Lock Owner              DBPROP_INIT_LOCKOWNER
Mode                    DBPROP_INIT_MODE				
Prompt                  DBPROP_INIT_PROMPT
Protection Level        DBPROP_INIT_PROTECTION_LEVEL
Extended Properties     DBPROP_INIT_PROVIDERSTRING
Connect Timeout         DBPROP_INIT_TIMEOUT			
Initial Catalog	      DBPROP_INIT_CATALOG
OLE DB Services	      DBPROP_INIT_OLEDBSERVICES
				
OLE DB 2.5 adds:
General Timeout	      DBPROP_INIT_GENERALTIMEOUT
				
There is no additional property for OLE DB 2.6. All of the above properties are defined under the Initialization Property Group "DBPROPSET_DBINIT".

REFERENCES

For more information regarding the IDataInitialize::GetDataSource() method, please refer to the MDAC SDK - OLE DB Programmer's Reference OLE DB Core Components Interfaces

Modification Type:MinorLast Reviewed:7/13/2004
Keywords:kbDatabase kbhowto kbProvider KB252348