Jump to content

SQL Connection Error


Recommended Posts

Hello all,

I am having problem connecting to my SQL database and have hit a snag as was wondering if anyone could help me out. Here is the code I've got:

$conn = ObjCreate( "ADODB.Connection" )

$DSN = "Driver={SQL SERVER};SERVER=**server**;PORT=**port**;UID=**username**;PWD=**password**;"

$conn.Open($DSN)

The error I keep getting is:

We intercepted a COM Error!

Number is: 80020009

Description is: [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.

I have tried changing the actual server name to IP address, I've tried adding Trusted_Connection=no to the script but same error every time. When adding the connection through SQL Developer 3.1 it adds the connection just fine with all of the same information specified above. I can ping the server just fine.

I have also tried a different driver using “Microsoft ODBC for Oracle” but receive the error:

We intercepted a COM Error!

Number is: 80020009

Description is: [Microsoft][ODBC Driver Manager]Driver’s SQLSetConnectAttr failed

Can anyone provide me with insight on what else I can try to get this connection working right?

Any help would be much appreciated :)

Edited by THERUNZ
Link to comment
Share on other sites

You missed "Database=" in your DSN

I use this DSN in my project for MSSQL server, I replace %variable% to real values before connection.

$DSN = "Driver={SQL Server};Server=%server%;Database=%database%;Uid=%name%;Pwd=%password%;"

You may try to use database master if you don't want some particular one.

EDIT:

If you use 64bit OS then try to use

#AutoIt3Wrapper_UseX64=n

Edited by Zedna
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...