Encrypted sqlite file problem in QT



  • Hi,
    I using Arcgis Runtime SDK for Qt 10.2.6 and Qt 5.4.2 (MSVC 2013, 32 bit) Qt Creator QT\QML side. And we are develop and deploy Adroid app with Android Armeobi-v7a (GCC4.9 , QT 5.4.2) kid.
    I try to open Local database with qml code but sqlite file has password .Is there any way to solve this problem with qml or c++? I download .sqlite file and .ini file from server and save it ,then I want to use it from qml side. But when I run this code I get “Error: file is encrypted or is not a database Unable to execute statement” . Here is below our code:

    var db = LocalStorage.openDatabaseSync("newdb", "1.0", "newdb", 1000000);
    db.transaction(
    function(tx) {
    var rs = tx.executeSql('SELECT * FROM Table);
    if(rs.rows.length<=0){
    showDialog("true")
    }else{
    showDialog("false")
    }
    }
    )

    Best Regards


  • Lifetime Qt Champion

    Hi,

    AFAIK, you can't access a custom database through the LocalStorage API. You can however make it available for example through a custom QSqlTableModel.



  • Hi,

    Are there any code example to open sqlite file with password in C++ side ?

    Thanks


  • Lifetime Qt Champion

    Are you using an encrypted database ?



  • Yes we are using encrypted database .We want to use and open sqlite file in qt side .Database encripted with password using SqliteConnection class from c# side.

    Thanks


  • Lifetime Qt Champion

    Then you should take a look at the SQLCipher project. AFAIK, you can also find instructions to build a Qt SQL plugin with it to use in your project.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.