Open DB from local URL



  • hi, I have a problem, I have to read and connect from local DB "mydb.db" SQLite so i create the connection:

    @ilMeteoDB = QSqlDatabase::addDatabase("QSQLITE","MYDB");
    ilMeteoDB.setDatabaseName(QCoreApplication::applicationDirPath() + "/mydb.db");@

    with this method I can create the connection and i can use "mydb.db" because the path of file is correct [the path is inside my project] but this method work only whit simulator because the path to application.exe is correct.

    but when i try to launch the application on device (Nokia - N8) the path that the method "applicationDirPath()" return is not correct to generate the db connection. I have read that isn't necessary the path from Embedded url but if i delete the method the result is the same. in particular the program generate a connection but if i return, for example, the name of the table of my db return only 1 table call "sqlite_master" or somthing like this and i can't interact whit my DB.

    now my answer is: how can i call my DB file correctly to generate the exaclty connection?

    sorry for my bad english and tnx if someone can help me.



  • What does the applicationDirPath() method output on your device and what do you expect it to output?



  • I expect the path of my application dir but it return this path "C:/Private/e6940e0f/" and i have search in my device this path whit external program to show hide dir but.... not exist...



  • Have a look at "this bug report":http://bugreports.qt.nokia.com/browse/QTBUG-18944


Log in to reply
 

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