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 />

    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.


    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?


    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>

    sub Session_OnStart
        OggettoDB.Open "driver={MySQL ODBC 5.1 Driver};server=XXX;User=XXX;PWD=XXX;database=studiorolle_it_catdb;option=3"
        Application ("inlinea") = Application ("inlinea") + 1
    end sub
    sub Session_OnEnd
        Application ("inlinea") = Application ("inlinea") - 1
        session("utente") = ""
        session("password") = ""
    end sub

    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:
    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")

    Set objRS = objConn.Execute("SELECT * FROM pro")

    While Not objRS.EOF
    Response.Write objRS.Fields("Nome") & ", " & objRS.Fields("Id_pro") & "<br />"

    Set objRS = Nothing
    Set objConn = Nothing

    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