If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Connecting ASP to MySQL DB not working

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-07-04, 11:47
peeechy3 peeechy3 is offline
Registered User
 
Join Date: May 2004
Posts: 4
Unhappy Connecting ASP to MySQL DB not working

Hi,

I have been trying to connect my ASP page to my MySQL DB for days and as a newbie to connecting to MySQL and using MySQL... It's not working and I'm at my wits end! Please help!

This is my code with connection script and how I'm using it...

<%Response.buffer = true%>
<HTML>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<%

'create connection, recordset objects
var rsEvents = Server.CreateObject("ADODB.Recordset");
rsEvents.ActiveConnection = "Driver={MySQL};DATABASE=dbname;UID=username;PASSW ORD=password;";

SQL= "SELECT * FROM NEWS;"
rs.Open SQL, ActiveConnection, 1

%>

<body>
<p class="shadow">News Board</P>
<table width="100%">
<tr>
<td>TITLE</td>
<td>PUBLICATION DATE</td>
<td>PARAGRAPH 1</td>
<td>PARAGRAPH 2</td>
<td>PARAGRAPH 3</td>
<td>PARAGRAPH 4</td>
<td>PARAGRAPH 5</td>
<td>PARAGRAPH 6</td>
<td>PARAGRAPH 7</td>
<td>PARAGRAPH 8</td>
</tr>
<%
IF not rs.eof Then
rs.MoveFirst
do while not rs.eof
%>
<tr>
<td><%=rs.Fields.item("TITLE").Value%></td>
<td><%=rs.Fields.item("PUB_DATE").Value%></td>
<td><%=rs.Fields.item("PARA1").Value%></td>
<td><%=rs.Fields.item("PARA2").Value%></td>
<td><%=rs.Fields.item("PARA3").Value%></td>
<td><%=rs.Fields.item("PARA4").Value%></td>
<td><%=rs.Fields.item("PARA5").Value%></td>
<td><%=rs.Fields.item("PARA6").Value%></td>
<td><%=rs.Fields.item("PARA7").Value%></td>
<td><%=rs.Fields.item("PARA8").Value%></td>
</tr>
<%
rs.MoveNext
Loop
END IF
%>
</table>

My host account uses chillisoft ASP as its linux based, and this is the format they tell us to connect to MySQL with.

Please help?!
Reply With Quote
  #2 (permalink)  
Old 05-07-04, 12:09
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
What is the error you're getting?
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #3 (permalink)  
Old 05-07-04, 12:20
peeechy3 peeechy3 is offline
Registered User
 
Join Date: May 2004
Posts: 4
I'm not getting any error, just a server timeout.

There are currently only two rows in the database so it can only be the connection I reckon.
Reply With Quote
  #4 (permalink)  
Old 05-07-04, 12:37
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
I'm not familair with chillisoft, but in traditional ASP you don't end a line with a semi-colon.. are you sure that's proper syntax in chillisoft ASP?
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #5 (permalink)  
Old 05-07-04, 12:39
peeechy3 peeechy3 is offline
Registered User
 
Join Date: May 2004
Posts: 4
Semi-colon where? which line?

I know what you mean. I'm used to connecting to a SQL Server 2000 DB and don't end my queries with a semi-colon usually if that was what you meant.
Reply With Quote
  #6 (permalink)  
Old 05-07-04, 12:52
peeechy3 peeechy3 is offline
Registered User
 
Join Date: May 2004
Posts: 4
Unhappy

I've changed my connection and query now to be more precise:

set conn=Server.CreateObject("ADODB.Connection")
ConnectionString = "Driver={MySQL}; Database=dbname; UID=username; PWD=password"

conn.open (ConnectionString)
set result=Server.CreateObject("ADODB.Recordset")

SQL= "SELECT TITLE, PUB_DATE, PARA1, PARA2, PARA3, PARA4, PARA5, PARA6, PARA7, PARA8"
SQL = SQL & "FROM NEWS "

set result = conn.execute(SQL)

I'm still getting a time out. I don't undestand.
Reply With Quote
  #7 (permalink)  
Old 05-08-04, 01:28
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
You need a space before "FROM", otherwise PARA8 and FROM run together...

But that would generate a different error... If you don't execute the SQL, does it still time out?
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On