×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    228

    Question database problem

    Hi,

    I have a problem concerning access a database from another application on my device.
    i have created an application which used "QSQLITE" and i have created "person" table.
    Now, i want to access this table ("person" table) from another application.
    Is that possible? and if yes, how can i do in order to access this table ???

    i have searched the wiki and i didn't found any useful solution.

    Regards

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: database problem

    Basically with symbian, then you should save tyhe database file in a folder that can be accessed through multiple processes (i.e. not in your own private folder), and then depending on API, you might need to close the database after each usage (since some APIs do not allow using database same time by multiple applications).

  3. #3
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    228

    Re: database problem

    Quote Originally Posted by symbianyucca View Post
    Basically with symbian, then you should save tyhe database file in a folder that can be accessed through multiple processes (i.e. not in your own private folder), and then depending on API, you might need to close the database after each usage (since some APIs do not allow using database same time by multiple applications).
    yes, i realized that my database is saved in the application private folder.
    but how can i save it in a specific path ???
    i have open it like the following :
    {
    db = QSqlDatabase::addDatabase("QSQLITE");

    QString privatePathQt(QApplication::applicationDirPath());
    QMessageBox::information(this,"path of the database",privatePathQt);

    db.setDatabaseName("my.db.sqlite");

    return db.open();
    }

  4. #4
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    228

    Re: database problem

    Quote Originally Posted by symbianyucca View Post
    Basically with symbian, then you should save tyhe database file in a folder that can be accessed through multiple processes (i.e. not in your own private folder), and then depending on API, you might need to close the database after each usage (since some APIs do not allow using database same time by multiple applications).
    ahhhh, i think that the save method is provided by the "db.setDatabaseName()"
    right ????

  5. #5
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: database problem

    you could try always defining the full path with the setDatabaseName.

    ok, was distracted, thus did not notice your anwer in the middle. Yep just try it and see what happens. Also do remember specify the drive

  6. #6
    Nokia Developer Champion
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: database problem

    Yes, you need to use the full path for setDatabaseName. Further, the path must be in Symbian/Windows forn (with backslashes) rather than Qt form. So you might code "C:\\somedir\\anotherdir\\myDb.db". Note that you need to double-up your backslashes.

    I prefer to find the file with QFileInfo (and verify its existence), extract the full path from that object, and then replace the slashes using QDir::toNativeSeparators.

  7. #7
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    228

    Re: database problem

    thank you all.
    it works well

Similar Threads

  1. Database problem
    By santu.paul@gmail.com in forum Symbian
    Replies: 1
    Last Post: 2009-06-09, 06:22
  2. Database problem??
    By ssabestian in forum Symbian
    Replies: 24
    Last Post: 2009-02-06, 07:12
  3. DataBase Problem
    By flipflop82 in forum Symbian
    Replies: 0
    Last Post: 2005-02-28, 21:05
  4. database problem
    By sridhar_ratna in forum Symbian
    Replies: 1
    Last Post: 2003-04-18, 09:07
  5. Database problem?
    By petrikaikko in forum Symbian
    Replies: 0
    Last Post: 2002-11-06, 15:12

Posting Permissions

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