I'm trying to move an old site done with ASP & MySql from a provider to another.
On the new provider I have this problem. All the page that use a connection to the database after 20-30 seconds of inactivity raise the error "500 - Internal server error.There is a problem with the resource you are looking for, and it cannot be displayed."
To view again the page without errors I have to restart the browser.
For example if I open the test page (test.aspx):
<%
sql = "SELECT * from fam"
set rsFam = OggettoDB.execute(sql)
%>
<%do while not rsFam.eof%>
<a class="col" href="/7Cat.asp?IDF=<%=rsFam("Id_Fam")%>&Nome=<%=rsFam("Nome")%>"><%=rsFam("Nome")%></a> <br />
<%rsFam.movenext
loop
rsFam.close
%>
I can see the links of this page without problems and click them with success.
But If I click on a link or if I refresh the page after 20 seconds of inactivity I have the error "500 - Internal server error.."
I'm using this connection string on the file Global.asa:
ilclaudio
Member
6 Points
9 Posts
Problem with MySql connection after inactivity
Mar 01, 2012 09:10 PM|LINK
Hi all,
I'm trying to move an old site done with ASP & MySql from a provider to another.
On the new provider I have this problem. All the page that use a connection to the database after 20-30 seconds of inactivity raise the error "500 - Internal server error.There is a problem with the resource you are looking for, and it cannot be displayed."
To view again the page without errors I have to restart the browser.
For example if I open the test page (test.aspx):
<%
sql = "SELECT * from fam"
set rsFam = OggettoDB.execute(sql)
%>
<%do while not rsFam.eof%>
<a class="col" href="/7Cat.asp?IDF=<%=rsFam("Id_Fam")%>&Nome=<%=rsFam("Nome")%>"><%=rsFam("Nome")%></a> <br />
<%rsFam.movenext
loop
rsFam.close
%>
I can see the links of this page without problems and click them with success.
But If I click on a link or if I refresh the page after 20 seconds of inactivity I have the error "500 - Internal server error.."
I'm using this connection string on the file Global.asa:
'OggettoDB.Open "driver={MySQL ODBC 3.51 Driver};server=localhost;UIDmin;PWD=XXXX;database=XXXX"
Which is the problem according to you?
Thank you very much.
Claudio
ignatandrei
All-Star
134960 Points
21632 Posts
Moderator
MVP
Re: Problem with MySql connection after inactivity
Mar 02, 2012 04:43 AM|LINK
database should be open latest, closed early.
ilclaudio
Member
6 Points
9 Posts
Re: Problem with MySql connection after inactivity
Mar 02, 2012 03:19 PM|LINK
Excuse me I didn't understand.
Should I leave the connection open?
Should I remove rsFam.close?
cld
ilclaudio
Member
6 Points
9 Posts
Re: Problem with MySql connection after inactivity
Mar 02, 2012 04:29 PM|LINK
This is my Global.asa file I think the problem is here:
<OBJECT RUNAT=Server SCOPE=Session ID=OggettoDB PROGID="ADODB.Connection"></OBJECT>
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
sub Session_OnStart
OggettoDB.Open "driver={MySQL ODBC 5.1 Driver};server=XXX;User=XXX;PWD=XXX;database=studiorolle_it_catdb;option=3"
Application.lock
Application ("inlinea") = Application ("inlinea") + 1
Application.unlock
end sub
sub Session_OnEnd
Application.lock
Application ("inlinea") = Application ("inlinea") - 1
Application.unlock
session("utente") = ""
session("password") = ""
OggettoDB.close
end sub
</SCRIPT>
ilclaudio
Member
6 Points
9 Posts
Re: Problem with MySql connection after inactivity
Mar 02, 2012 04:39 PM|LINK
The error raised by the application is
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[MySQL][ODBC 5.1 Driver][mysqld-5.5.13-enterprise-commercial-advanced-log]MySQL server has gone away
But if I test this page:
Se provo questa pagina:
<html>
<%
Dim sConnection, objConn , objRS
sConnection = "driver={MySQL ODBC 5.1 Driver};server=XXX;User=XXX;PWD=XXX;database=xxx;option=3"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open(sConnection)
Set objRS = objConn.Execute("SELECT * FROM pro")
While Not objRS.EOF
Response.Write objRS.Fields("Nome") & ", " & objRS.Fields("Id_pro") & "<br />"
objRS.MoveNext
Wend
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>
</html>
I have no problems.
So the problem is in the code of the first page, but i don't understand which is the difference.
All the application uses queries such as in the first example.