Mysql connection object
is there a way of checking that a mysql connection is open before i try to run a query through it?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
patrickPosted Jan 10, 2010, 11:38 AM
if (Connection.State == ConnectionState.Closed)
{ Connection.Open(); }
else if (Connection.State == ConnectionState.Broken)
{ Connection.Close();
Connection.Open(); }
patrickPosted Jan 9, 2010, 11:13 PM
if(mysqlConnection==isOpen){execute}
else {
mysqlConnection.open();
execute
}
But theres no mysqlConnection==isOpen command - so I need to know how to do this
The point of this is i want to use the same connection in a singleton pattern rather than instantiate and open/close connections
Lalit MPosted Jan 9, 2010, 1:24 AM
http://www.weberdev.com/get_example-138.html