Hello,

I'm trying to use SQLite in an application where it's needed to work with
one database in mutliple threads. Based on all the info I read in SQLite
documentation I create a new database connection for every new thread
created. Each thread does some SELECTs, INSERTs or UPDATEs, but there isn't
any schema modification. If multiple threads are running, I encounter some
strange problems:

1. Occasionally after running Sqlite3_step() I get SQLITE_CANTOPEN ('Unable
to open the database file') error. I found out that it can be fixed by
running the query again, i.e. again calling Sqlite3_Prepare(). So this isn't
a big issue, but still I wonder why this error message is returned?
Shouldn't SQLITE_BUSY or SQLITE_LOCKED be returned instead?

2. More serious issue is that after I enable transaction usage (not used in
1.) sometimes (again, it's random) after calling 'BEGIN TRANSACTION' I get
an error SQLITE_ERROR ('cannot start a transaction within a transaction').
Problem is that I definitely am not already in a transaction. The only
reason for this seems to be that there's >1 thread running, with only 1
thread running there's no problem.

I tried this also with the latest version of SQLite (3.3.6 on Windows).

Any idea what can I do about it?

Thanks,
Jiri

Reply via email to