Link to home
Start Free TrialLog in
Avatar of jking1234
jking1234

asked on

oledb connection to SQL Server not working

In Access 2007, (trying to access SQL Server) I have the following code:
    Dim cn As New ADODB.Connection
    Dim strCN As String
    strCN = "Provider=SQLOLEDB;Server=10.10.10.1;" & _
             "Initial Catalog='Websites';User ID=sa;PWD=xxxxxxxx"

    cn.CommandTimeout = 3000000
    cn.Open

This gives the following error:
[Microsoft][ODBSC Driver Manager] Data Source Name not found and no default driver specified
Avatar of Bitsqueezer
Bitsqueezer
Flag of Germany image

Hi,

I would recommend to use the SQLNCLI driver instead (must be installed on Windows XP machines, not available by default).

Moreover you should make sure that TCP/IP is enabled on the SQL Server if you access the server by IP address.
You can find examples of connection strings here:
http://www.connectionstrings.com/sql-server-2005#p2

There is also an example of how to use the IP address.

And I hope that this string was only an example and you don't really try to connect to the SQL Server using the "sa" account...:-)

Cheers,

Christian
ASKER CERTIFIED SOLUTION
Avatar of jking1234
jking1234

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jking1234
jking1234

ASKER

zzz