

Provider=SQLNCLI10.1 Integrated Security=sspi Initial Catalog=tempdb Data Source=akl6 Use Procedure for Prepare=1 Auto Translate=True Packet Size=4096 Workstation ID=AKL5 Use Encryption for Data=False Tag with column collation when possible=False MARS Connection=False DataTypeCompatibility=0 Trust Server Certificate=False Set connection = CreateObject("ADODB.Connection")Ĭonnection.ConnectionString = "provider=sqlncli10 data source=akl6 integrated security=sspi initial catalog=tempdb" For matched keywords, the corresponding properties will be set, everything else goes into “Extended Properties”.Ĭonsider the following example in VBScript: ) to see which initialization properties provider supports (for SQL Server Native Client it is DBPROPSET_SQLSERVERDBINIT). Oledb32 process a connection string as follows: it tries to find the keywords corresponding to the generic OLE DB initialization keywords (corresponding to DBPROPSET_DBINIT), and it also queries a provider by using MultipleActiveResultSets is a keyword for ADO.NET, and MARS_Connection is for ODBC. Moreover, MarsConn=yes will have no effect, see explanation below. “Server”, “Database”, “Trusted_Connection” and “MarsConn” are not the names of the OLE DB initialization properties (which would be “Data Source”, “Integrated Security”, and “Mars Connection”). Here “Provider” keyword is used by oledb32 to find a CLSID of the provider to instantiate. Provider=SQLNCLI10 Server=myServerAddress Database=myDataBase Trusted_Connection=yes MarsConn=yes Įquivalent key-value pair: "MultipleActiveResultSets=true" equals "MARS_Connection=yes" SQL Server Native Client 10.0 OLE DB Provider However, in practice, lack of understanding leads consumers to use a combination of keywords both corresponding to the generic OLE DB properties and to provider specific keywords making sense only in the context of the provider string.įor example the site listing lots of examples of connection strings has the following for Consumers should use this property only for provider-specific connection information that cannot be explicitly described through the property mechanism." Use of this property implies that the consumer knows how this string will be interpreted and used by the provider. "A string containing provider-specific, extended connection information. These are the so called “Extended Properties” (DBPROP_INIT_PROVIDERSTRING). What makes the situation especially confusing is that one of the properties is similar to a connection string. OLE DB Initialization Properties: Quick Reference This also applies to ADO so for an ADO programmer, a connection string is a similar concept but the way the provider looks at it is frequently misunderstood.įrom the provider point of view there is no such thing as a connection string, instead the provider understands the initialization properties, which are hinted to in the above passage as “complex array of structures to access data”. This way, you get additional services from oledb32 like session pooling, automatic transaction enlistment, cursor engine, and support for additional interfaces. “when accessing OLE DB directly” actually means that the application doesn’t directly instantiate a corresponding provider object, but rather goes through the “service component”, (otherwise known as “core services”, layer (oledb32.dll) by doing something like:ĬLSID_MSDASC, // CLSID of “service component” ), the connection string is passed as a parameter to create an OLE DB data source object." Without a connection string, you would be required to store or pass a complex array of structures to access data. "A connection string is a string version of the initialization properties needed to connect to a data store and enables you to easily store connection information within your application or to pass it between applications.

One problem is that OLE DB itself does not define connection string as a provider concept. (Anton Klimov, a developer on the SQL Server Native Client team, wrote the following article.)Ĭonnection strings for an OLE DB provider is a concept that causes a lot of confusion.
