Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


asp connection to mysql database

asp connection to mysql database


I'm trying to connect via asp to a mysql database on their server. I've created the database and added a users table. I have an opensource intranet (UAPortal) that is really plug&play, it comes with an Access database attached, so you just load it on your server and go. But I want to use it with the faster, more capable mysql server that comes with asphostportal hosting. I have the connection strings given by asphostportal, but when I try to incorporate that info into the common.asp file, I get this:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'localhost' (10061)

/Common.asp, line 34

Please tell me what I'm doing wrong. I'm self-taught, so type slowly!

All advice is appreciated!

RE: asp connection to mysql database

can you post the connection string?

Borislav Borissov
VFP9 SP2, SQL Server

RE: asp connection to mysql database

I use this but error

CODE -->

Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword

db_server = ""
db_name = "your_dbusername"
db_username = "your_dbusername"
db_userpassword = "your_dbpassword"
fieldname = "your_field"
tablename = "your_table"

connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr

qry = "SELECT * FROM " & tablename

Set oRS = oConn.Execute(qry)

if not oRS.EOF then
while not oRS.EOF
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "
end if

Set oRs = nothing
Set oConn = nothing


RE: asp connection to mysql database

Is that


db_server = "" 
actual value?
because I didn't see any "localhost" string in your connection string.

Borislav Borissov
VFP9 SP2, SQL Server

RE: asp connection to mysql database

ahaaaa I think I need replaced


db_server = 
with my database hostname from the Hosting Control Panel. bigsmile

RE: asp connection to mysql database

You need to replace these also:

db_name = "your_dbusername"
db_username = "your_dbusername"
db_userpassword = "your_dbpassword"

Borislav Borissov
VFP9 SP2, SQL Server

RE: asp connection to mysql database

yes... I'll replace it. thank bro bigglasses

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close