MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 13th, 2005, 04:53 PM
Shai Shoo Shai Shoo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 3 Shai Shoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 2 m 55 sec
Reputation Power: 0
Cool How to Run ASP sript with MySQL instead of access. And how to configure the DSN

I'm trying to connect to MySQL with ASP. I have my apache server set to: /localhost:8080. And my IIS to: /localhost. I am trying to configure the dsn, but it won't connect to the server. My ASP scripts are in: C:\Inetpub\wwwroot. Then my db is in: C:\Program Files\MySQL\MySQL Server 4.1\data. What i did (tried couple of times) when configuring my dsn:

----------------------------
MYSQL ODBC 3.51
----------------------------
DSN = mydatabase // i can name it anything right?
Description = MySQL ODBC .....
Host/Server = localhost:8080
Databasename = example
User = root
password = mypass
Port (if not 3306) = 3306 //Is that right?
SQL Command... =
------------------------------
I tried to test the connection but failed.

I wanna try a script I found on the net:

--------------------------------
Connect to a MySQL database

In this example we will show you how to connect to a MySQL database .

Create a database like this.

CREATE DATABASE example;
USE example;


CREATE TABLE example(url VARCHAR(40) , description TEXT);

INSERT INTO example VALUES('http://www.google.com' , ' The best search engine');
INSERT INTO example VALUES('http://www.beginnersphp.co.uk' , 'top notch php site');
INSERT INTO example VALUES('http://www.myscripting.com','Scripting resources galore here');



This is a simple example which will display links on your page , now lets move on to the script
----------
<%
'declare some constants that are used in the script
Dim adOpenForwardOnly , adLockReadOnly , adCmdTable


adOpenForwardOnly = 0
adLockReadOnly =1
adCmdTable =2


'variable declaration in here
Dim objConn , objRS


'create our objects
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")


'connect to the MySQL example database
objConn.Open "driver={MySQL ODBC 3.51 Driver};server=localhost:8080;uid=root;pwd=mypass; database=example"


'Microsoft SQL Server ODBC Driver example
'cnstr = "driver={SQL Server};server=myserver;" & _
'"database=pubs;uid=<username>;pwd=<strong password>"
'cn.Connect = cnstr


'open the example table
objRS.Open "example" , objConn , adOpenForwardOnly , adLockReadOnly , adCmdTable


'display all data in the table
While Not objRS.EOF
Response.Write objRS.Fields("URL") & "&nbsp"
Response.Write objRS.Fields("description") & "&nbsp"
Response.Write "<p>"
objRS.MoveNext
Wend


'close recordset
objRS.Close

'destroy all objects
Set objRS = Nothing
Set onjConn = Nothing
%>

---------------------

Can someone help? I am currently working on ASP using the access database, but I would like to try to use mySQL using navicat. Thanks in advance.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > How to Run ASP sript with MySQL instead of access. And how to configure the DSN


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway