#29 Calling conn.Open() with already open conn should fail

open
nobody
None
5
2006-02-24
2006-02-24
k__
No

Within the MySQLDriverCS Open() function, if the
connection handle is already open, it is closed, and
the function continues opening a new connection.

To be consistent with the Sql client driver (MSSQL),
the function should throw an exception if an attempt
is made to open a connection on an already opened
connection. This lets the user know he has an error.
Also MySQL does not properly handle a connection
being opened and closed in a forloop.

ie.

try
{
MySQLConnection conn = new MySQLConnection(...);

for (int i=0; i<10; i++)
{
// on the second call to this, an exception
should be thrown
conn.Open();

// while the driver will close the connection
each time and re-open it
// mysql does not deal with this properly and
may freeze up
}
}
catch (Exception excep)
{
}
finally
{
conn.Close();
}

Discussion