QSqlDatabase has driver but cannot use it
-
I have PC version Qt and embedded Linux Qt,
a sqlitecipher plugin driver is compiled for both platforms, but QSqlDatabase cannot use it to process database.
Is there any mistake I have when compiling Qt for embedded Linux?Code:
qDebug() << QSqlDatabase::drivers(); QSqlDatabase dbconn = QSqlDatabase::addDatabase("SQLITECIPHER"); dbconn.setDatabaseName("database.lib"); dbconn.setPassword("correctPW"); qDebug() << dbconn.tables();'
Here is the debug output:
("QSQLITE", "SQLITECIPHER")
correctPW ---------(Note: I put a debug() in plugin library, embedded linux version cannot show it.)
(all table names can be seem in PC version, but not embedded linux)Configure for Qt:
./configure -v -prefix /home/name/qt5/ -release -opensource -qt-libpng -qt-zlib -qt-libjpeg -plugin-sql-sqlite -widgets -qt-sql-sqlite -make libs -no-cups -no-nis -no-iconv -no-dbus -no-openssl -no-iconv -no-sse2 -no-c++11 -xplatform linux-arm-gnueabi-g++ -nomake tools -nomake examples -nomake tests -no-glib -strip -linuxfb -I /usr/local/tslib/include -L /usr/local/tslib/lib -confirm-license -
One solution is in test program's .pro file, add reference:
also need to copy library files to plugins/sqldrivers/ folder.unix:!macx: LIBS += -L$$OUT_PWD/../sqlitecipher/ -lsqlitecipher INCLUDEPATH += $$PWD/../sqlitecipher DEPENDPATH += $$PWD/../sqlitecipher