Compartilhar via


Referencing a Connection String in Your Application

You can enable your end users to build, save, and access connection strings and .udl files within your own applications. You can invoke the Data Link user interface programmatically whenever you need the user to specify what data to access.

The information that is returned from the Data Link user interface can be used to create OLE DB data source objects. For more information about creating data source objects, see the OLE DB IDataInitialize interface.

For greater performance, you can enable .udl pooling by adding "Udl Pooling" to the registry key "SOFTWARE\Microsoft\DataAccess" under HKEY_LOCAL_MACHINE. A Cache Size value greater than 0 (Cache Size=1) will enable the feature. A value of 100 is recommended. The .udl pooling feature allows connection information to be cached using IDataInitialize::LoadStringFromStorage and then passed to IDataInitialize::GetDataSource.

You can call the Data Link API from any application development tool, such as Microsoft? Visual C++?, that supports the access of COM objects.

To access the Data Link API from applications that can directly access a COM interface, use the OLE DB IDBPromptInitialize interface.

See Also

Reference

Data Link API Overview

Connection String Syntax