By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,846 Members | 1,862 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,846 IT Pros & Developers. It's quick & easy.

mysqldb

P: n/a
Hi
I am using MySQLdb. I want to know how can I check whether a
connection is open or not.If it is open I want to use the existing
connection else create a new connection by
db=MySQLdb.connection(.........)
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ketulp,
Can you default the connection to None.

def foo(x,y,z,connection=None):
if not connection:
connection = OpenMyConnection()
.....

You could then use foo with or without an open
connection.

wes

ke***********@yahoo.com wrote:
Hi
I am using MySQLdb. I want to know how can I check whether a
connection is open or not.If it is open I want to use the existing
connection else create a new connection by
db=MySQLdb.connection(.........)


Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.