[SOLVED] How to write in a database on N950?
-
I am trying to connect to sqlite Db, but i always get
bq. Bus error ( core Dumb)Could any body help me, please?
-
As a general note, you should always try to make a testcase, as well as copying and pasting the exact errors you get. And I'm quite sure that you never get a core Dumb error.
-
Sorry for spilling mistake , here is the error i got
bq. Bus error (core dumped)
I am just trying to open the Db file on meego OS, however the code is working fine on symbian.
I just changed the paths of the DB.@
symbian{
dbFiles.sources += faces.db
dbFiles.path = ./data/
DEPLOYMENT += dbFiles
}
unix:!symbian{
db.files = faces.db
db.path = /opt/myApplication/data
INSTALLS += db
}@//dbConnector.cpp
@#ifdef Q_OS_SYMBIAN
iDB = new QSqlDatabase(QSqlDatabase::addDatabase("QSQLITE"));
QString path = QDir::currentPath();
path.append("/data/faces.db");
#else
QString path("/opt/myApplication/data/faces.db");
#endif@Thank you for your help
-
Do you really mean to have the creation of the database object only for symbian?
-
Ohhhhh sorry it is a big mistake, really i didn't notice that.
Thank you very much.but I got another error i think this time it is a real error, when i try to write or read from the DB file I always get the following message.
bq. "attempt to write a readonly database Unable to fetch row"the database exists in the following path
"/opt/myapplication/data/faces.db"
-
You don't seem to have rights to modify the database in question.
-
yes, I think it a problem of permission, So should i change it's path or there is a way to change the Db permission pragmatically.
I saw the db file permission and it was (-rw-r--r--) I think that the only one who has the permission to write the file is the root.
How can I deal with that?
Thanks in advance -
When I tried to run the application as root the application was successfully able to read and write the DB file.
SO how can I change the permission of the Db for the User? -
Hi,
I had similar problems and they are caused by the deployment setting permissions to read only. So this is what I did to solve this.- Created a post installation script named ex. myapp.postinst.
- Inside that script copied the file I would like to use ex. @cp /opt/myapp/path/to/file.txt /opt/myapp/path/to/copy.txt@ and also @chmod a+rwx /opt/myapp/path/to/copy.txt@ to change permissions..
- Created a pre removal script named doing removing stuff
- The application must of course use the copied file created from the post installation script.
-
how could you add this post script to the package?
-
You could do that from inside QtCreator also, you should already have added the packaging files for Debian Harmattan device. Then just right click to the root item named qt_packaging/Debian_Harmattan and in the wizzard select the choice 'text file' and supply a name for that file. Then rename the new file to "myapp.postinst", add your code and that's it .
-
I did that but i didn't copy the db file i just changed it's permission and it's parent folder
chmod a+w /home/user/.myapplication/data
chmod a+w /home/user/.myapplication/dataThank you
-
Could that also.. :-)