Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User wetnose's Avatar
    Join Date
    Dec 2009
    Posts
    3
    Hello,
    Apologies I realize this question gets asked a lot, but cannot find the answer.
    My existing sqlite db is found and opened when running the simulator in my win7 dev environment. The db file is searched for (and found) under %CURRENT_USER%.
    When deploying to N8, the file is never found. Looks like the app always looks in c:\ location and can never find the file.

    In my PRO file I have:

    QT += core \
    gui \
    sql

    database.sources = mydb.db.sqlite
    database.path = .
    DEPLOYMENT += database

    My db open routine:

    bool DatabaseManager:penDB()
    {
    // Find QSLite driver
    db = QSqlDatabase::addDatabase("QSQLITE");
    // http://doc.trolltech.com/4.5/sql-driver.html#qsqlite

    QString path(QDir::home().path());
    path.append(QDir::separator()).append("mydb.db.sqlite");
    path = QDir::toNativeSeparators(path);
    db.setDatabaseName(path);

    // Open databasee
    return db.open();
    }

    The file in question (mydb.db.sqlite) is at the same directory level as the pro file.

    What am I missing here?

    Thanks,
    Radu

  2. #2
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    Looks good offhand. Try printing out the final path name (as a label, or with qDebug) and see if it appears to be correct.

    I've used this for opening a DB:
    Code:
        QString dbName("SampleDB.db");
        QFileInfo info(dbName);
        QString absoluteName;
        absoluteName = QDir::toNativeSeparators(info.absoluteFilePath());
        db.setDatabaseName(absoluteName);

Similar Threads

  1. Creating .sisx file including images,xml,db file
    By chandan444ever in forum Symbian C++
    Replies: 2
    Last Post: 2010-05-27, 10:29
  2. Is there any way to open DB file?
    By yugandhar.pathi in forum Symbian C++
    Replies: 1
    Last Post: 2008-11-06, 09:12
  3. Help!How to convert pc db file into symbian db
    By yaohongwang in forum Symbian C++
    Replies: 2
    Last Post: 2008-06-18, 09:52
  4. about .db editor on pc or vb connect .db file
    By kingqq007 in forum Python
    Replies: 2
    Last Post: 2008-01-29, 14:13
  5. Creation db file
    By silviuccia in forum Symbian C++
    Replies: 0
    Last Post: 2007-01-30, 10:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved