Results 1 to 6 of 6

Thread: is it possible to conect qt with sqlite 3

  1. #1
    Join Date
    Jul 2010
    Posts
    5
    Qt products
    Qt/Embedded

    Default is it possible to conect qt with sqlite 3

    HI im working on arm plataform, until now my qt crosscompilation worked well but i want to know if its possible to connect qt with sqlite3 because thats the database i have to use on that device i look for the driver on the package where i m working and i found this drivers:

    db2 ibase mysql oci odbc psql sqlite sqlite2 tds

    sqlite means sqlite or sqlite3?? i have this BIG DOUBT please HELP!!!!

  2. #2
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: is it possible to conect qt with sqlite 3

    Yes you can connect to sqlite3. In your .pro file, have the following:

    QT += sql

    Then in your code to open a connection to a db file, you would use something like this:

    dbInfo::dbInfo()
    {
    theDb = QSqlDatabase::addDatabase(QSQLITE);
    theDb.setDatabaseName(theDb.db);
    }

    bool dbInfo::testConnection() {

    if (!theDb.open()) {
    return false;
    }
    return true;
    }

    Then you can execute QSqlQuery's and store them in QSqlRecord's. Also, the QSQLITE driver is for sqlite3. Hope this helps.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: is it possible to conect qt with sqlite 3

    sqlite is sqlite3. You can also build the plugin yourself and enable different sqlite settings like FTS3 if needed. The sources for sqlite are in the 3rdparty directiory. There you can also update sqlite to the new version 3.7.0. It will work cross platform! I never had troubles with that (Win, Linux and Mac).

  4. #4
    Join Date
    Jul 2010
    Posts
    5
    Qt products
    Qt/Embedded

    Default Re: is it possible to conect qt with sqlite 3

    thanks for your fast answer!!

  5. #5
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default Re: is it possible to conect qt with sqlite 3

    Hi guys, sorry to interrupt,

    I am currently developing app with sqlite database, but i found a problem when i deploy my app in real symbian device, it found the database, but got an error "unable to open database file"
    but my code works fine in simulator

    Do you know what's wrong with it?

    thanks

  6. #6
    Join Date
    Nov 2010
    Posts
    30
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: is it possible to conect qt with sqlite 3

    sqlite work good in windows and linux..
    but when i use FTS in sqlite...
    at linux work good but can not work in windows..

    how can i solve this bug ?

Similar Threads

  1. [Qt][SQLite] Two problems with SQLite.
    By Xandareva in forum Newbie
    Replies: 6
    Last Post: 6th April 2010, 23:06
  2. Conect and do select in a database mysql
    By mmm286 in forum Newbie
    Replies: 1
    Last Post: 10th March 2010, 16:21
  3. Help Sqlite + QT
    By vinny gracindo in forum Newbie
    Replies: 4
    Last Post: 5th December 2009, 07:33
  4. xml + sqlite
    By eleanor in forum Qt Programming
    Replies: 1
    Last Post: 7th May 2009, 17:06
  5. Sqlite DB
    By Tara in forum Qt Programming
    Replies: 6
    Last Post: 12th May 2008, 19:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.