MySQL Forums
Forum List  »  Connector/Python

Python DB API Techniques
Posted by: Eric Buehl
Date: January 10, 2006 09:31PM

I am writing an application in python that makes many database calls through the runtime, across several objects and multiple threads. So, my question is: What is the proper technique for doing all of this? I would think that it makes sense to establish as few database connections as possible, but how can these resources be shared? More specifically, can I create one connection object at startup and then share it with all my threads and objects which create their own cursor objects and then call multiple queries

Can connection objects be used for more than one cursor? In parallel?
Can cursor objects be used used for more than one query?
Are connection objects threadsafe?
Are cursor objects threadsafe?
Are connection object reliable after a long time of no activity? Do they timeout, and need to be re-established?


Options: ReplyQuote

Written By
Python DB API Techniques
January 10, 2006 09:31PM
January 11, 2006 04:45AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.