Hello!
I've got a problem. I'm using sqlite3 in my C++ project. In the log I've
got error's *DB is locked error code 5*. As I know error code 5 means, that
DB is busy. To solve this I started to use WAL journal mode. But it doesn't
help.

In my program I've got 2 connections to the same db. I use mutexes for both
DB connections.
I'm opening connections with this code:








*if (sqlite3_open_v2(db_path.c_str(), &this->db, SQLITE_OPEN_READWRITE |
SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX, 0) ) {
LOG4CPLUS_FATAL(this->logger, "Can not open/create DB " <<
sqlite3_errmsg(db));    sqlite3_close(this->db);}if (sqlite3_exec(this->db,
"PRAGMA journal_mode = WAL;", 0, 0, &err)) {
LOG4CPLUS_ERROR(this->logger, "SQL det journal mode error: " << err);
sqlite3_free(err);}*

First connection is used for inserting data to the DB. It happens with 4
time every second.
Second connection is used for starting transaction, selecting, updating,
deleting data and committing. It happens every 5 seconds.

I'm getting errors from the first connection.

Please help me to solve this problem.

P.S. Sorry for my bad English

Reply via email to