PDA

View Full Version : SQLite driver unavailable



kandalf
22nd November 2006, 00:06
Hi guys, I have a new problem.
I'm trying to open a SQLite database but, when I do addDatabase("QSQLITE") I got this error:


leonardo@niquel:~/svn/testqt4/bin$ ./testqt4
QSqlDatabase: QSQLITE driver not loaded
QSqlDatabase: available drivers:


The driver is compiled as a plugin and exists in sqldrivers directory


leonardo@niquel:~/svn/testqt4/bin$ ls /usr/local/qt421/plugins/sqldrivers/
libqsqlite.a libqsqlmysql.a libqsqlodbc.a


What am I doing wrong again?
I've been looking the examples, but every show just the QSqlDatabase::addDatabase("QSQLITE") sentence, but I don't know what to do if the driver is not loaded.

Thanx a lot in advance.

wysota
22nd November 2006, 00:45
Are you sure these are plugins (what OS do you use? For example under Linux plugins should have a "so" extension)? Did you compile Qt statically? You can't use plugins with a static build of Qt.

kandalf
22nd November 2006, 13:41
Thanks Wysota, I have compiled statically under linux. I will recompile it since, at home, I have compiled it dinamicaly and the plugin works just fine.

Cheers.

kandalf
22nd November 2006, 16:30
The problem was solved recompiling Qt with shared libraries.

wysota
22nd November 2006, 18:55
You can also compile Qt statically and have the sql driver available but you have to compile the support directly into Qt libraries. See configure -help for details.

burakozturk
11th February 2009, 17:36
You can also compile Qt statically and have the sql driver available but you have to compile the support directly into Qt libraries. See configure -help for details.

did you mean ./configure -static -qt-sql-sqlite ?

Edit :
i have configured with this ./configure -static -qt-sql-sqlite and it works.