Closing Connections between Queries

Kyle Stevens <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
At my job, I work on an application that was started by someone else.  
It has a few main database functions, NonQuery(sql), GetValue(sql), 
CheckValue(sql), whose purposes should be self explanatory.  Every time 
one of these functions are called, it creates a new database connection, 
does it's business, and closes the connection.  The application in 
question is actually in Visual Basic, but the question remains valid for 
an application I want to start with Python and SQLite.   Is it best to 
open and close the connection on each query, or should the connection 
remain open throughout the life of the application?  Also, does the 
answer differ depending on the DBMS used or whether it is a single user 
or multi user environment?

Any comments or suggestions would be greatly appreciated.

Thanks,

-Kyle Stevens
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.