jtaylor
08-05-2004, 02:55 PM
Hello!
I'm having a problem...obviously or I wouldn't be posting! :p
Anyways, my problem is that I'm trying to connect to a MySQL database that is hosted by our web server host site. I want to connect to it using ASP pages and specifically using Javascript code. I've looked at thousands of examples of connection strings for both Javascript and VBScript but nothing has worked. I've tried setting up a system DSN and i've downloaded the latest ODBC driver (MySQL ODBC 3.51 Driver) for MySQL and the test connection works just fine but not in ASP.
This is what I think it should look like using Javascript:
<% @Language=Javascript %>
<HTML>
<HEAD>
<%
var conn = Server.CreateObject ("ADODB.Connection");
conn.Open ("DRIVER={MySQL ODBC 3.51 Driver};SERVER=my_server;DATABASE=my_database;UID=my_uid;PWD=my_pwd");
//just an aside here, i've tried using DRIVER={MySQL} instead of the above stated driver, didn't work. I've tried using the IP address and the actual host header for the server name and none have worked. I've tried changing the attribute PWD to PASSWORD and have added the attribute OPTION and PORT with the correct information but those haven't worked either...continuing on
var sql = "SELECT * FROM my_table";
var rs = Server.CreateObject ("ADODB.Recordset");
rs.Open (sql,conn,1,3);
Response.Write (rs.Recordcount);
%>
</HEAD>
...
So, that's the basic setup I would use for any database connection whether it be for Access or for Excel, you would just change the connection string to suit the driver needs.
I continuously receive this error whenever I try to run this script:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/testMYSQL.asp, line 9
...
Of course, this points straight to my connection string and explains that my driver is not correct or at least that's what I get out of it. So what am I doing wrong? I've made sure all my info is correct. I've made sure I have the correct access permissions to my database. I can connect to it directly from my website if I post the same script there but once I try to connect to it from my local machine using a IIS website it gives me that error everytime.
Is there some standard connection string for this or am I attempting the impossible? Any help would be greatly appreciated.
Thanks all!
I'm having a problem...obviously or I wouldn't be posting! :p
Anyways, my problem is that I'm trying to connect to a MySQL database that is hosted by our web server host site. I want to connect to it using ASP pages and specifically using Javascript code. I've looked at thousands of examples of connection strings for both Javascript and VBScript but nothing has worked. I've tried setting up a system DSN and i've downloaded the latest ODBC driver (MySQL ODBC 3.51 Driver) for MySQL and the test connection works just fine but not in ASP.
This is what I think it should look like using Javascript:
<% @Language=Javascript %>
<HTML>
<HEAD>
<%
var conn = Server.CreateObject ("ADODB.Connection");
conn.Open ("DRIVER={MySQL ODBC 3.51 Driver};SERVER=my_server;DATABASE=my_database;UID=my_uid;PWD=my_pwd");
//just an aside here, i've tried using DRIVER={MySQL} instead of the above stated driver, didn't work. I've tried using the IP address and the actual host header for the server name and none have worked. I've tried changing the attribute PWD to PASSWORD and have added the attribute OPTION and PORT with the correct information but those haven't worked either...continuing on
var sql = "SELECT * FROM my_table";
var rs = Server.CreateObject ("ADODB.Recordset");
rs.Open (sql,conn,1,3);
Response.Write (rs.Recordcount);
%>
</HEAD>
...
So, that's the basic setup I would use for any database connection whether it be for Access or for Excel, you would just change the connection string to suit the driver needs.
I continuously receive this error whenever I try to run this script:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/testMYSQL.asp, line 9
...
Of course, this points straight to my connection string and explains that my driver is not correct or at least that's what I get out of it. So what am I doing wrong? I've made sure all my info is correct. I've made sure I have the correct access permissions to my database. I can connect to it directly from my website if I post the same script there but once I try to connect to it from my local machine using a IIS website it gives me that error everytime.
Is there some standard connection string for this or am I attempting the impossible? Any help would be greatly appreciated.
Thanks all!