PDA

View Full Version : QSQlite driver



praveen_g
16th November 2009, 08:15
Hi,

how do I connect QSQlite database from Linux (Fedora 9)

tried to connect to the database with the following code

//connecting to the database
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(":memory:");
if (!db.open()) {
QMessageBox::critical(0, qApp->tr("Cannot open database"),
qApp->tr("Click Cancel to exit."), QMessageBox::Cancel);

And it returns with the following error
Error :
QSqlDatabase: QSQLITE driver not loaded
QSqlDatabase: available drivers:


I tried to build QT with
configure -qt-sql-qsqlite ( also tried with -plugiin-sql-qsqlite
gmake
gmake install

can somebody guide, to resolve this problem ?


thanks in advance

calhal
16th November 2009, 10:15
as you can read typing ./configure --help, try

./configure -qt-sql-sqlite -plugin-sql-sqlite

also don't forget to add the following to your *.pro file:


QT += sql

praveen_g
16th November 2009, 12:42
Thanks calhal,

but even this did not work. Is there any other way ?

calhal
16th November 2009, 16:22
Do you have any files in <your_Qt_prefix>/plugins/sqldrivers?

If not, how do you exactly compile Qt (show the ./configure command you've used)? During configure (before you type make), can you see something like this:
SQLite support ..... plugin(qt)

praveen_g
17th November 2009, 04:04
Hi

first of all I have tried it in two different systems

1. Open suse
2. Fedora 9

the one in Open suse is working perfectly fine, but nothing is happening in Fedora 9.

could you tell me how can i uninstall QT in fedora 9 ? so that I could try reinstalling again.

thanks

praveen_g
17th November 2009, 11:31
Hi,

Yes during configuration there is an entry saying

SQLite support ..... plugin(qt)

but still couldn't connect to the database ...

thanks

praveen_g
18th November 2009, 08:58
how do I check the dependencies for sqlite to build with QT 4.3 ?

could not succeed in configuring Sqlite with QT in Fedora Core 9, can somebody help me out in this front ?

Its pretty urgent

thanks