Wrox Programmer Forums

Need to download code?

View our list of code downloads.

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 September 23rd, 2003, 06:33 AM
Authorized User
 
Join Date: Aug 2003
Location: , , United Kingdom.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ells228
Default ASP connection to MySQL

Hi,

I have a client that is having slow data connections to an Access MDB, and the ISP has provided a free MySQL db.

1. Is it possible to connect to MySQL using ASP ?
2. How would i do this ?

Cheers,
C.

Chris Ellis
Icon-Business Ltd
www.icon-business.net
Chris@Icon-Business.net
__________________
Cheers,
C.

Chris Ellis
Icon-Business Ltd
www.icon-business.net
Chris@Icon-Business.net
Reply With Quote
  #2 (permalink)  
Old September 24th, 2003, 05:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen, , Denmark.
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, yes it is possible. I have once done it myself. I will get back with an answer later...! I have to find some old project.

Jacob.

Reply With Quote
  #3 (permalink)  
Old September 24th, 2003, 05:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen, , Denmark.
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I found it pretty quickly. It is something like this...

Code:
Dim SomeDB
Set SomeDB = Server.CreateObject ("ADODB.Connection")
SomeDB.Open ("DRIVER=mysql;SERVER=[servername];UID=[username];PWD=[password];DATABASE=[databasename]")

Dim recTmp
Set recTmp = Server.CreateObject ("ADODB.Recordset")
recTmp.Open "SELECT * FROM testtable", SomeDB

Do
    Response.Write(recTmp("testcolumn"))
    recTmp.MoveNext
Loop While Not recTmp.EOF

recTmp.Close
Set recTmp = Nothing

SomeDB.Close
Set SomeDB = Nothing
Be aware that you have to change the red parts in the above connection string with the right value, and naturally use you name for the table and column.

Actually the way I found out about this was in the book 'Professional ASP Data Access' (WROX) which has got a section on MySQL databases, and how to connect to these.

Hope this helps ;)

Jacob.
Reply With Quote
  #4 (permalink)  
Old July 28th, 2006, 12:23 PM
Authorized User
 
Join Date: Dec 2005
Location: Mingora, NWFP, Pakistan.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to shahhussain Send a message via Yahoo to shahhussain
Default

Hello Mr. Jacob.
I have used the driver you have specified above for MySql Database but when i browse the
page it throws an Error as :
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/sql.asp, line 12

while i am using the MySql Database name = [testing] table name =[test] and server=[localhost]
and the code i have written is as :
Dim SomeDB
Set SomeDB = Server.CreateObject ("ADODB.Connection")
SomeDB.Open ("DRIVER=mysql; SERVER=[localhost]; UID=[shah]; PWD=[thefire]; DATABASE=[testing]")

Dim objRS
Set objRS= Server.CreateObject ("ADODB.Recordset")
objRS.Open "SELECT * FROM test", SomeDB

Do
    response.write("name = " & objRS.fields("name").value & "<br>")
    response.write("Email = " & objRS.fields("email").value)

    recTmp.MoveNext
Loop While Not objRS.EOF

objRS.Close
Set objRS= Nothing

SomeDB.Close
Set SomeDB = Nothing

Please hlep me in this thanks.


Shahhussain
Reply With Quote
  #5 (permalink)  
Old July 31st, 2006, 09:05 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Your connection string should look something like this:

"Driver={MySQL ODBC 3.51 Driver};Server=localhost;"
     "Database=testing;User=shah;Password=thefire;Optio n=4;"

You will need to install the 3.51 ODBC driver on your system for this to work.

www.mysql.com

"The one language all programmers understand is profanity."
Reply With Quote
  #6 (permalink)  
Old June 21st, 2017, 01:38 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2017
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please help ORDER BY issue

When I add ORDER BY deals.DEAL_ID before LIMIT the page times out and never loads. It works perfect without it. Please HELP !!!!

Set ors = oConn.Execute("SELECT deals.DEAL_ID, deals.EMP_ID, users.fname AS empfname, users.lname AS emplname, users.usrcomm AS empdesc, deals.CLOSER_ID, userz.fname AS clsrfname, userz.usrcomm AS clsrdesc, userz.lname AS clsrlname, deals.split_comm, deals.EMP_LOC, deals.DEAL_DATE, deals.fname, deals.midname, deals.spfname, deals.splname, deals.lname, deals.address1, deals.address2, deals.city, deals.state, deals.zipcode, deals.phone1, deals.phone2, deals.email_addy, deals.pmnt_type, deals.cc_name, deals.card1, deals.card2, deals.card3, deals.card4, deals.card_exp_mo, deals.card_exp_yr, deals.cid_id, deals.bank_name, deals.check_numb, deals.route_numb, deals.acct_numb, deals.app_code, deals.deal_amt, deals.processthru, deals.resortcomp, deals.pkgname, deals.pri_location, deals.tripdetail, deals.pkgcost, deals.rmtype, deals.gift1, deals.gift2, deals.gift3, deals.gift4, deals.gift5, deals.gift6, deals.deal_status, deals.assigned_to AS prev_status, deals.CONF_PREFIX AS conf_code, deals.verify_date, users_1.UID AS verifid, users_1.fname AS vfname, users_1.lname AS vlname, deals.pmnt_date, deals.shdate, deals.cancel_date, deals.cancel_wk, deals.payroll_wk, deals.chargeback_wk, deals.mgr_cb_wk, deals.clsr_cb_wk, deals.pay_amt, deals.clsr_amt, deals.mgr, userz_1.fname AS mgrfname, userz_1.lname AS mgrlname, deals.go_green, deals.mail_sent, deals.deal_printed, deals.deal_issue, deals.wk_tag, deals.mnth_tag, deals.yr_tag, deals.deal_time, deals.vartime, deals.payshift, deals.dfield1, userz_2.fname AS hbfname, userz_2.lname AS hblname, deals.dfield2, deals.dfield3, deals.dfield4, deals.flagit, deals.source FROM ((((deals LEFT JOIN userz ON deals.CLOSER_ID = userz.UID) LEFT JOIN userz AS userz_1 ON deals.mgr = userz_1.UID) LEFT JOIN userz AS userz_2 ON deals.dfield1 = userz_2.UID) LEFT JOIN users AS users_1 ON deals.varifid = users_1.UID) LEFT JOIN users ON deals.EMP_ID = users.UID WHERE (((deals.deal_status) <> 'Delete')) LIMIT " & Session("pgsz") & "")
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
ASP-Mysql connection beeded surendran Classic ASP Databases 1 September 15th, 2005 05:24 AM
Asp and Mysql Connection surendran Classic ASP Basics 3 September 15th, 2005 05:22 AM
connection error MYSQL and ASP renee_santoscoi MySQL 5 March 7th, 2005 10:15 AM
ASP Connection to MySQL fs22 Classic ASP Databases 1 August 18th, 2004 11:35 PM
ASP.NET database connection MySQL socoolbrewster ASP.NET 1.0 and 1.1 Basics 3 November 21st, 2003 06:12 PM



All times are GMT -4. The time now is 05:23 AM.


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