Asked by:
Invalid connection string attribute - SQL

Question
-
User680477399 posted
I want to connect to my (My)SQL database using Classic ASP.
This is my code:
Function GetDatabase() Dim Connection Set Connection = Server.CreateObject("ADODB.Connection") Connection.Open = "Provider=SQLNCLI11;DRIVER={SQL Server};SERVER=127.0.0.1;Database=cms;Uid=root;Pwd=123456789zZ;Trusted_Connection=yes;" If Connection.errors.count = 0 Then Repsonse.Write("OK") End If End Function MyConnection = GetDatabase()
But that doesn't work. It gives me this error:
Microsoft SQL Server Native Client 11.0 error'80004005' Invalid connection string attribute /asp/conn.asp, row 8
Any ideas on how to fix that? I've googled for hours... and I couldn't find any answers, Thanks!
Wednesday, July 31, 2013 11:59 AM
All replies
-
User-76669496 posted
Hi,
Your connection string is referencing SQL Server which is why you're getting the error. Try using:
DRIVER={MySQL ODBC 5.1 Driver};
You can see the full syntax here:
http://www.connectionstrings.com/mysql-connector-odbc-5-1/
Wednesday, July 31, 2013 12:17 PM -
User680477399 posted
Hi,
Your connection string is referencing SQL Server which is why you're getting the error. Try using:
DRIVER={MySQL ODBC 5.1 Driver};
You can see the full syntax here:
http://www.connectionstrings.com/mysql-connector-odbc-5-1/
Doesn't work. Same error.
And this doesnt work either:
Connection.Open = "Provider=MSDASQL;Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=cms;User=root;Password=123456789zZ;Option=3;Trusted_Connection=yes;"
The data-source can not be found and no driver is given.
Wednesday, July 31, 2013 12:30 PM -
User1183424175 posted
Hi,
Please try installing 32-bit MySQL ODBC 5.1 Driver instead of 64-bit ones. And please refer the similar thread
http://forums.iis.net/t/1187401.aspx/1
Hope it can help you.
Friday, August 2, 2013 4:28 AM -
User680477399 posted
Pengzhen Song - MSFT
Hi,
Please try installing 32-bit MySQL ODBC 5.1 Driver instead of 64-bit ones. And please refer the similar thread
http://forums.iis.net/t/1187401.aspx/1
Hope it can help you.
I have uninstalled the 64-bit version and installed the 32-bit version of the program.
Provider=MSDASQL;Driver={MySQL ODBC 5.2 Driver};Server=localhost;Database=cms;User=root;Password=123456789zZ;Option=3;
BUT I get this error then:
Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Friday, August 2, 2013 12:58 PM -
User1183424175 posted
Hi,
Have you checked this http://stackoverflow.com/questions/14862777/connecting-mysql-with-classic-asp-error
please try this:
Server_Name = "localhost" 'connect to the local remort database server databseName = "db" 'database name mySQLUser = "root" 'user name mysqlPassword = "admin" 'passwrd of the db user ConStr= "Driver={MySQL ODBC 5.1 Driver};SERVER=" & Server_Name & ";DATABASE=" & databseName & ";UID=" & mySQLUser & ";PWD=" & mysqlPassword & ";PORT=3306;OPTION=67108864;" ' Connection string
Hope it can help you
Wednesday, August 7, 2013 2:42 AM -
User680477399 posted
Hi, Have you checked this http://stackoverflow.com/questions/14862777/connecting-mysql-with-classic-asp-error please try this: Server_Name = "localhost" 'connect to the local remort database server databseName = "db" 'database name mySQLUser = "root" 'user name mysqlPassword = "admin" 'passwrd of the db user ConStr= "Driver={MySQL ODBC 5.1 Driver};SERVER=" & Server_Name & ";DATABASE=" & databseName & ";UID=" & mySQLUser & ";PWD=" & mysqlPassword & ";PORT=3306;OPTION=67108864;" ' Connection string
Hope it can help you
Hello, I don't think that works.
This is my conn.asp:
Dim objConn Set objConn = Server.CreateObject("ADODB.Connection") Server_Name = "localhost" 'connect to the local remort database server databseName = "cms" 'database name mySQLUser = "root" 'user name mysqlPassword = "123456789zZ" 'passwrd of the db user objConn = "Driver={MySQL ODBC 5.1 Driver};SERVER=" & Server_Name & ";DATABASE=" & databseName & ";UID=" & mySQLUser & ";PWD=" & mysqlPassword & ";PORT=3306;OPTION=67108864;" ' Connection string objConn.Open
And it gives me this error:
Error Type: Microsoft VBScript runtime (0x800A01A8) Object required: 'DRIVER={MySQL ODBC 5' /asp/conn.asp, line 15
Please... help me.
Saturday, August 10, 2013 6:06 PM -
User521890537 posted
Do you have Mysql installed on same server?
This part of your connection string should be removed "Trusted_Connection=yes;"
Sunday, August 11, 2013 10:22 PM -
User521890537 posted
I did not see your last reply.
The error message means there's some systanx error in objConn variable
Check out the sample code in this thread http://forums.asp.net/t/1142542.aspx/1
Replace version in "MySQL ODBC 3.51 Driver" with the version of mysql odbc driver installed on your computer.
Sunday, August 11, 2013 10:29 PM -
User680477399 posted
I did not see your last reply.
The error message means there's some systanx error in objConn variable
Check out the sample code in this thread http://forums.asp.net/t/1142542.aspx/1
Replace version in "MySQL ODBC 3.51 Driver" with the version of mysql odbc driver installed on your computer.
Isn't that for Asp.NET?
I need help with my CLASSIC asp.
Monday, August 12, 2013 10:39 AM -
User-789993887 posted
I had this issue a few times over the last few months and the problem was always the same thing - time zones.
If your client and database are on different servers, check that the system clocks are set to the same time / timezone.
Friday, June 2, 2017 3:13 PM