|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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") & " " Response.Write objRS.Fields("description") & " " 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. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > How to Run ASP sript with MySQL instead of access. And how to configure the DSN |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|