I am unable to connect to an SQL2005 instance using CCADO. The error returned is:
Method 'open' in COM object of class 'ADODB.Connection' returned error code 0x80004005 (E_FAIL) which means: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
I can connect to the actual AXDB server using the following example below, but any other SQL instance returns the above error message.
ccadoconnection connSQL2005;
connSQL2005 = new ccadoconnection();
connSQL2005.connectionString(
'Provider=sqloledb; server=sqlserver\instance; Initial Catalog=master; ' +
// 'Provider=sqloledb; server=axdb; Initial Catalog=master; ' +
'Integrated Security=SSPI');
// 'User ID=sa; Password=******');
connSQL2005.open();
Additional Information:
*This post is locked for comments
I have the same question (0)Solved it!
I tried every possible connection string for OLEDB that I could think of and in the end it came down to simply changing the '\' in the server_name\instance to '\\'!
So to connect to an SQL Server with instance name the following connection strings work (provider can also be sqlncli):
connSQL2005.connectionString(
'Provider=sqloledb; server=server_name\\instance; Initial Catalog=master; ' +
'Integrated Security=SSPI');
or
connSQL2005.connectionString(
'Provider=sqloledb; server=server_name\\instance; Initial Catalog=master; ' +
'User ID=sa; Password=******);
Syed Haris Shah
9
Mea_
4
Martin Dráb
2
Most Valuable Professional