Using a db three times at the same time
-
hi to every one
i have a program using qsqlite plugin
i want to run it three times at the same time
and these programs should use one db name mydb.db,i want to know if a query happened at the same time does it have any problem? -
bq. i want to run it three times at the same time
Could you please elaborate the issue ?
-
if my programs runs three query at the same time on my data base , does it have a problem or no?
-
If you are trying to run 1 program and three queries, there are no problems!
But if you are trying to run more than one program upon a single db file, there could be some problem regarding read/write locks!
-
how can i solve it?
-
You may use "shared-cache mode":http://www.sqlite.org/sharedcache.html.
-
is it enough i use this code?
@db.setConnectOptions("QSQLITE_ENABLE_SHARED_CACHE=1;");@ -
Yes, that is correct. :)
Remember, as per "doc":http://doc.qt.nokia.com/latest/qsqldatabase.html#setConnectOptionsbq. This must be done before the connection is opened or it has no effect