[SOLVED] How to write in a database on N950?
-
wrote on 26 Oct 2011, 15:22 last edited by
I am trying to connect to sqlite Db, but i always get
bq. Bus error ( core Dumb)Could any body help me, please?
-
wrote on 26 Oct 2011, 15:59 last edited by
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.
-
wrote on 26 Oct 2011, 21:50 last edited by
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
-
wrote on 27 Oct 2011, 07:00 last edited by
Do you really mean to have the creation of the database object only for symbian?
-
wrote on 27 Oct 2011, 09:41 last edited by
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"
-
wrote on 27 Oct 2011, 10:07 last edited by
You don't seem to have rights to modify the database in question.
-
wrote on 27 Oct 2011, 10:48 last edited by
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 -
wrote on 27 Oct 2011, 16:28 last edited by
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? -
wrote on 28 Oct 2011, 08:22 last edited by
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.
-
wrote on 28 Oct 2011, 13:38 last edited by
how could you add this post script to the package?
-
wrote on 29 Oct 2011, 13:53 last edited by
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 .
-
wrote on 30 Oct 2011, 05:56 last edited by
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
-
wrote on 30 Oct 2011, 12:00 last edited by
Could that also.. :-)
1/13