From 10:00 CET Friday 22nd November we will adjust how the server works to deal with some recently reported problems. Therefore there may be a load problem, if you experience more problems than usual trying to access the forum then please PM AndyS or any of the moderators so they can inform me.

Database is locked. Unable to fetch row in "DETACH DATABASE..."

  • In my restless dreams I see this code:

    bool DatabaseManager::saveEncryptedDatabase(const QString &path, const QString &password)
        QSqlQuery q;
        q.exec(QString("ATTACH DATABASE '%1' AS encrypted KEY '%2'").arg(path, password));
        q.exec(QString("SELECT sqlcipher_export('encrypted')"));
        q.exec("DETACH DATABASE encrypted");
        return true;

    Where Utils::handleSqlError is printing error if any occured.

    "SQL Query Error: database encrypted is locked Unable to fetch row in\nDETACH DATABASE encrypted"

    I have even delayed it to timer and tried to detach every 250ms. No luck. I've tried with transactions. Still nothing though.
    I've got dandruff on my head.