PDA

View Full Version : is it possible to conect qt with sqlite 3



felipe12357
27th July 2010, 21:32
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!!!!

cloaked_and_coastin
28th July 2010, 05:43
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.

Lykurg
28th July 2010, 06:02
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).

felipe12357
28th July 2010, 14:29
thanks for your fast answer!!

axel07
13th December 2010, 00:08
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

solook
9th April 2011, 15:54
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 ?