C++ SQLite3 encrypted DB



  • Hallo

    I've encrypted my SQLite3 db by Navicat ! : alt text

    So my code:

    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
        db.setDatabaseName(QApplication::applicationDirPath()+ QDir::separator() + "test.db");
    

    and db.login() return true ;

    but my trying to execute a query :

    QSqlQuery q("SELECT * FROM test");
        while(q.next())
            qDebug()<<q.value(0).toString();
        qDebug()<<q.lastError().text();
    

    so i got :

    "file is encrypted or is not a database Unable to execute statement"
    

    i've also try to

    db.setPassword("mypass");
    

    but also didn't work


  • Lifetime Qt Champion

    Hi,

    SQLite is not encrypted by default so you should check with the Navicat folks whether they are using SQLCipher for that.

    AFAIR, there are instructions available to build a plugin for Qt using SQLCipher so it's worth checking.



  • @SGaist i've checked they use wxSQLite3 for encrypet , Qt dosen't supoort it right ? so i need to include the wxSQLite3 library in my project and use it ?


  • Lifetime Qt Champion

    Looks like you might be lucky. QtCipherSqlitePlugin.might be what you need.



  • @SGaist thx :)


Log in to reply