Gil Delavous <[EMAIL PROTECTED]>
wrote:
I was wondering if its better to open a sqlite database connection
when my application launches, use it all along the process life, and closing
it when it exits... or if its better to open/close the database
connection each time a method has to query/store data, thus leaving the database
not open all the time.

There is no downside to keeping the database open. On the other hand, when SQLite opens the database it reads and parses its schema, which takes some (short) time, so you usually don't want to do it too often.

As my application is multithreaded (each thread open its own, global
connection too) I'm not sure if holding connections is the best way to
avoid conflicts (I sometimes have SQLITE_MISUSE errors).

Just holding a connection open doesn't cause conflicts by itself - you need to actually execute some statement.

SQLITE_MISUSE error doesn't indicate a conflict (SQLITE_BUSY does) - it means you are doing something wrong, like trying to execute a statement that was already finalized. In other words, SQLITE_MISUSE signals a bug in your program. Find it and fix it.

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to