Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 25th, 2017, 12:50 AM
Registered User
 
Join Date: Nov 2017
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Connecting to MySql with Classic ASP

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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem connecting classic asp to SQLserver 2008 express via IIS7 on win7 64bit alextf Classic ASP Databases 2 February 6th, 2011 12:32 PM
free web hosting for Classic ASP and a MySQL DB crmpicco Classic ASP Basics 1 March 14th, 2007 07:00 AM
Error Connecting to MySQL with ASP.Net arovner Classic ASP Databases 0 April 27th, 2005 02:49 PM
Connecting to mySQL WIx ASP.NET 1.0 and 1.1 Basics 3 October 17th, 2004 05:13 PM



All times are GMT -4. The time now is 08:25 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.