Years ago I bought your book "Beginning Active Server Pages 3.0" and used Javascript and ASP to run a web-based MS Access database on GoDaddy. Now GoDaddy no longer supports Access databases, so I created an identical database in MySQL Community Server 5.7.20 (MAC OS), then used Workbench 6.3.10 to export the empty database structure to a self-contained dump file. Next I created a new MySQL database at GoDaddy and imported the dump file using their phpAdmin tool. I then used BullZip to migrate the record data into the GoDaddy database. BullZip had no difficulty connecting to the new MySQL database at GoDaddy.
My web pages were created in Dreamweaver MX 2004 and I used Active Server Pages 3.0 to write the connection script below: (which worked perfectly for years, until GoDaddy stopped hosting Access databases)
1 <%
2 Dim connectSTR
3 connectSTR = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=G:/PleskVhosts/myDomain.com/pathtomyDBfolder/myDBname.mdb"
4
5 Dim tbl_name
6 Dim tbl_name_numRows
7
8 On Error Resume Next
9 Set tbl_name = Server.CreateObject("ADODB.Recordset")
10 tbl_name.ActiveConnection = MM_ppc_STRING
11 tbl_name.Source = "SELECT * FROM myTable ORDER BY ORD DESC"
12 tbl_name.CursorType = 0
13 tbl_name.CursorLocation = 2
14 tbl_name.LockType = 1
15 tbl_name.Open()
16
17 tbl_name_numRows = 0
18
19 Dim myVar1, myVar2
20 While Not tbl_name.EOF
21 myVar1=tbl_name.Fields.Item("Var1").value
22 myVar2=tbl_orders.Fields.Item("Var2").value
23 tbl_name.MoveNext
24 Wend
25
26 Response.Write (tbl_name.Fields.Item("Var1").value)
27 Response.Write (tbl_name.Fields.Item("Var2â).value)
28 %>
I have been getting 500 - Internal server errors when I try to connect to the new mySQL database using various code modifications. The site is huge (57,976 html pages) so I was hoping that I could connect to the new DB by simply modifying the connection script which is a separate file that is included into each page as needed. Here are two of the modifications that I've tried that donât work:
Dim connectSTR
connectSTR = "Driver={MySQL ODBC 5.3 Driver};DBQ=G:/PleskVhosts/myDomain.com/pathtoMySQLserver/50.62.209.9/myDBname;USER=myUsername;PASSWORD=myPasswordâ
Dim connectSTR
connectSTR = "Driver={MySQL ODBC 5.3 Driver};SERVER=50.62.209.9;DATABASE=myDBname;USER= myUsername;PASSWORD=myPasswordâ
If I rem out lines 19 to 24 the 500 error disappears but nothing prints for the Field values (because they are still null?)
Any suggestions as to what is going on here? Is it even possible to make classic ASP 3 ADO connections to MySQL?
I searched GoDaddy help and online forums and tried various code alternatives for lines 9 to 15 but none of them worked. Hereâs the one from GoDaddyâs help pages:
https://in.godaddy.com/help/connecti...and-aspado-260
Connecting to a MySQL Database Using File DSN and ASP/ADO
1 <%
2 Dim oConn, oRs
3 Dim qry, connectstr, sDSNDir
4 Dim db_name, db_username, db_userpassword
5 Dim db_server, dsn_name
6
7 dsn_name = "your_dsn_name" - (is this âDriver={MySQL ODBC 5.3 Driver}â or just my db_name ??)
8 fieldname = "your_fieldname"
9 tablename = "your_tablename"
10
11 sDSNDir = Server.MapPath("_dsn") - (maps to G:\PleskVhosts\myDomain.com\mySiteFolder\_dsn)
12
13 connectstr = "filedsn=" & sDSNDir & "\" & dsn_name
14
15 Set oConn = Server.CreateObject("ADODB.Connection")
16 oConn.Open connectstr
17 qry = "SELECT * FROM " & tablename
18
19 Set oRS = oConn.Execute(qry)
20
21 if not oRS.EOF then
22 while not oRS.EOF
23 response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & ""
24 oRS.movenext
25 wend
26 oRS.close
27 end if
28
29 Set oRs = nothing
30 Set oConn = nothing
31 %>
like the first code, f I rem out lines 19 to 27 the 500 error disappears but no connection has been made