I'm using Qt5 with an QSqlDatabase with QSQLITE. I initialize the Database with
Qt Code:
  1. db = QSqlDatabase::addDatabase("QSQLITE");
  2. db.setDatabaseName("test.db");
  3. if (!db.open()) { ...}
To copy to clipboard, switch view to plain text mode 

Two instances of the program or running on the same machine therefore both or using the same test.db database file. The initialization of the database works fine, but when executing

Qt Code:
  1. bool DataStorageHandler::executeStmt(QString stmt) {
  2. QSqlQuery qry(this->db);
  3. qry.prepare(stmt);
  4.  
  5. if (!qry.exec()) {
  6. qDebug() << stmt;
  7. this->dbError = qry.lastError().text();
  8. return false;
  9. } else
  10. return true;
  11. }
To copy to clipboard, switch view to plain text mode 

Both instances at this point are executing an INSERT-Stmt but one of them gets an error

database is locked Unable to fetch row

I don't understand why? Shouldn't sqlite handle different accesses to the DB?