THERUNZ Posted July 5, 2012 Share Posted July 5, 2012 (edited) 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: 80020009Description 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: 80020009Description is: [Microsoft][ODBC Driver Manager]Driver’s SQLSetConnectAttr failedCan anyone provide me with insight on what else I can try to get this connection working right?Any help would be much appreciated Edited July 5, 2012 by THERUNZ Link to comment Share on other sites More sharing options...
DicatoroftheUSA Posted July 5, 2012 Share Posted July 5, 2012 I am assuming you can login manually to the server, Can you telnet to the server with the IP and port you are using? Statism is violence, Taxation is theft. Autoit Wiki Link to comment Share on other sites More sharing options...
THERUNZ Posted July 6, 2012 Author Share Posted July 6, 2012 I am able to login to the server manually and im able to telnet into it. Could there be something in my code that I'm missing? Link to comment Share on other sites More sharing options...
DicatoroftheUSA Posted July 6, 2012 Share Posted July 6, 2012 I am pretty sure there is something wrong with your connection string. It simply doesn't look like ones I have seen in the past. You might want to Google various examples of how they are implemented through vbs script, as the string should be the same for you. Statism is violence, Taxation is theft. Autoit Wiki Link to comment Share on other sites More sharing options...
Zedna Posted July 6, 2012 Share Posted July 6, 2012 (edited) You missed "Database=" in your DSNI 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 July 6, 2012 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now