locked
MySQL Connection wan't close RRS feed

  • Question

  • User-1027591367 posted

    Hello, i've a big problem....

    I'm using ASP.NET with 4.0 framework wich connect to a MySQL 5.0 database by ODBC .NET object, exactly OdbcConnection object with 3.51 Driver.

    After published, the website have a problem with connection....i would say after navigate on 5-6 page or if i refresh the same page more times, i could not see data extracted from database...sometimes i obatin a "Too many connection" error message...

    I check for closing connection in the code behind and i'm sure i've called closing connection function everytime after the use, but it seem wannot close connection.

    In local, with Cassini webserver i have not problemes, but using IIS and tracing connection with MySQL Administration tool, i could see more connection stay in SLEEP state as far as i have too many connection and the process stop tu run correctly (i have to kill the connection manually).

    The ClosingConnection function contain was called after every data extraction and finally in the masterpage on UNLOAD event with this code:

    If ObjConn.State <> Data.ConnectionState.Closed Then
                    ObjConn.Close()
                    ObjConn.Dispose()
                    'ObjConn = Nothing
                End If

    so i think will be closed...but was not.

    The connection class have not DISPOSE method....may be this the problem ?? If yes, how could i do ?

    Now....i don't know if is normal MySQL maintain many connection in a sleep mode ...maybe it close yourself when the number of connection is more than a fix value ??

    I don't know how solve this problem...the published website stop to extract data after some pages navigation resulting not usable....

    This is my connection string

    "driver={MySQL ODBC 5.1 Driver};option=3;pooling=true;Min Pool Size=0;Max Pool Size=100;connection timeout=20;"

    i try to change the connection strings but wan't work...

    Thank to all answerLaughing

    Sunday, March 25, 2012 7:09 AM

Answers

  • User-1027591367 posted

    It not run, just tryied...

    After a month of changements i definitively solve problem abandon ODBC Connection which appear to have serious problems with asp.net

    Now i use MySQL Connector/NET 6.3.8 ad all run perfectly without sleeping connection...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 3, 2012 2:30 AM

All replies

  • User-638331144 posted

    set pooling=true; to pooling=false;

    Monday, April 2, 2012 11:30 PM
  • User-1027591367 posted

    It not run, just tryied...

    After a month of changements i definitively solve problem abandon ODBC Connection which appear to have serious problems with asp.net

    Now i use MySQL Connector/NET 6.3.8 ad all run perfectly without sleeping connection...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 3, 2012 2:30 AM