×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    31

    ERROR in writing to database in N9

    my pakcage in N9 contains a sqlite database file located in opt/myproject/Databases/

    and i 've successfully connect the database through my codes
    Then i do the following codes:

    db.transaction(function(tx) {

    tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
    // Add (another) greeting row
    tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);

    when i debug it with QT simulator ,it began error like the below description.

    Error: attempt to write a readonly database Unable to fetch row

    //And i 've found that ,if i deploy any files in the N9's opt/ directory ,i can only read and cant write to it .
    What was wrong ,and how i could do to write the file???

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2009
    Posts
    200

    Re: ERROR in writing to database in N9

    Most likely the actual files are in read only mode. That's the standard unless you specifically do something about it.

    However recommended place for user writable files are in user's home directory /home/user. So perhaps you could copy database files to /home/user/.somedir on applications first startup?

    Other possibility is to change file permissions in postinst script.

    Edit:
    Maybe you should refer again to data storage locations documentation. /home/user/.somedir is just quick and dirty, but you should you the official locations.
    http://harmattan-dev.nokia.com/docs/...a_storage.html
    Last edited by mikkovtr; 2012-10-19 at 12:59.

  3. #3
    Registered User
    Join Date
    Sep 2012
    Posts
    31

    Re: ERROR in writing to database in N9

    yeah,thank you for answering my problem.
    Hoever i cant find any useful imfomation in thu url you given,and i 've read much of the developer doucument and didnt find any useful imfomation.
    Perhaps i am not familiar with what solution you were talking,I wonder if you or anyone can directly tell me a solution to solve this problem.

    'could copy database files to /home/user/.somedir on applications first startup?' as this you told, how could i do so?

  4. #4
    Registered User
    Join Date
    Sep 2012
    Posts
    31

    Re: ERROR in writing to database in N9

    I've solved this problem by myself.Just use the postinst file and add some commands in it such as change the database's permissions in local file system is OK.
    Very easy..

Similar Threads

  1. exe and application reading and writing database
    By raj8nokiaforum in forum Symbian
    Replies: 3
    Last Post: 2009-10-06, 10:42
  2. Reading & Writing SIM contact database
    By nsivach in forum Symbian
    Replies: 8
    Last Post: 2009-01-21, 05:19
  3. Replies: 4
    Last Post: 2007-05-31, 07:06
  4. receiving sms by my handy to writing database
    By alfacen in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2002-08-21, 11:24
  5. receiving sms by my handy to writing database
    By alfacen in forum General Messaging
    Replies: 0
    Last Post: 2002-08-20, 19:50

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •