locked
Problem with MySql connection after inactivity RRS feed

  • Question

  • User1805789888 posted

    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;UID­min;PWD=XXXX;database=XXXX"

    Which is the problem according to you?

    Thank you very much.

    Claudio

    Thursday, March 1, 2012 5:10 PM

All replies

  • User197322208 posted

    database should be open latest, closed early.

    Friday, March 2, 2012 12:43 AM
  • User1805789888 posted

    Excuse me I didn't understand.

    Should I leave the connection open?

    Should I remove  rsFam.close?

    cld

    Friday, March 2, 2012 11:19 AM
  • User1805789888 posted

    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>

    Friday, March 2, 2012 12:29 PM
  • User1805789888 posted

    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.

    Friday, March 2, 2012 12:39 PM