Bug #8131 Data Adapter doesn't close connection
Submitted: 25 Jan 2005 14:01 Modified: 18 Oct 2006 10:25
Reporter: Terri Kelley Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:current OS:Microsoft Windows (Windows XP Pro SP2)
Assigned to: Reggie Burnett CPU Architecture:Any

[25 Jan 2005 14:01] Terri Kelley
Description:
MySql is located on a Slackware 10 Linux box on a local network.  I am working on an a Windows Forms application in C# where the user first logs on and if a admin then goes to an admin mdi.  From there he may select to update an employee's record.  From the time the user first logs in there is a persistant connection from the data adapter instead of closing it after it retrieves the information from the data base.  As you move through the application this is leading to Connection must be valid or open exceptions.  I have a thread in the /NET forum on this that gives relevant code etc.
http://forums.mysql.com/read.php?38,11877

tk

How to repeat:
Occurs everytime the user wants to add a new employee or update a record.  Exception is thrown on the relevant da.update for that sub (eg update or new).

Suggested fix:
Connection should close to the server once the da has retrieved its data from the database.
[27 Jan 2005 5:53] Terri Kelley
Work around for this right now is to create a new MySqlConnection object and use it when instantiating the adapter.  Then prior to .update, open the connection and after the .update, close the connection.
[27 Jan 2005 5:54] Terri Kelley
Forgot to say, use the connection object instead of the a connection string.
[4 Feb 2005 17:37] Ward Durossette
I am seeing connections not being closed period.  Don't know about the data adapter portion of this bug title.  I have code that performs multiple open/closes on a database, and I can watch the connection usage graph in MySQL administrator steadily climb until it hits one hundred, at which point an exception is thrown.  This code worked on ODBC, with the only change being to replace the "ODBCConnection" with "MySQLConnection".  Of course, I also replaced all the ODBC to MySQL on the command, and datareader objects as well.  This is a horrific bug, and makes the connector unusable.
[4 Feb 2005 17:55] Terri Kelley
I agree with Ward.  You still have a persistant connection but so far I have been able to avoid the earlier mentioned exception being thrown by using the workaround I mentioned earlier.
[1 Sep 2005 10:08] [ name withheld ]
Is this bug still being worked on? I cannot use the .NET adaptor if this isn't rectified and would very much like to!
[15 Sep 2006 14:58] Richard Klamrzynski
Ward is correct, Connector/Net is completely unuseable so long as the connection stays persistant.  It is now well over a year later and the error is still present and has been carried over to Connector/Net 5.0.   Is anyone working on this?
[26 Sep 2006 21:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/12575
[26 Sep 2006 21:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/12576
[26 Sep 2006 21:37] Reggie Burnett
Fixed in 1.0.8, already fixed in 5.0.1
[18 Oct 2006 10:25] MC Brown
A note has been added to the 1.0.8 changelog.