Hi All
Running Red Hat Enterprise Linux Server release 5.4 (Tikanga) with Qt4.7.0 32-bit and downloaded and yum installed MySQL-embedded-community-5.1.50-1.rhel5.i386.rpm (wish to embed MySQL)
Followed all the directions as set out here (with some path changes and the necessary changes for the embedded lib):
http://doc.trolltech.com/4.7-snapshot/sql-driver.html
This is what I have in ../../../src/plugins/sqldrivers/mysql
[root@localhost mysql]# ll
total 29204
-rwxr-xr-x 1 root root 29686009 Sep 8 13:01 libqsqlmysql.so
-rw-r--r-- 1 root root 2798 Jun 2 04:03 main.cpp
-rw-r--r-- 1 root root 10244 Sep 8 13:01 main.o
-rw-r--r-- 1 root root 8947 Sep 8 12:58 Makefile
-rw-r--r-- 1 root root 2641 Sep 8 13:01 moc_qsql_mysql.cpp
-rw-r--r-- 1 root root 5940 Sep 8 13:01 moc_qsql_mysql.o
-rw-r--r-- 1 root root 585 Jun 2 04:03 mysql.pro
-rw-r--r-- 1 root root 2412 Sep 8 13:01 qsql_mysql.moc
-rw-r--r-- 1 root root 79112 Sep 8 13:01 qsql_mysql.o
-rw-r--r-- 1 root root 204 Jun 2 04:03 README
[root@localhost mysql]# ll
total 29204
-rwxr-xr-x 1 root root 29686009 Sep 8 13:01 libqsqlmysql.so
-rw-r--r-- 1 root root 2798 Jun 2 04:03 main.cpp
-rw-r--r-- 1 root root 10244 Sep 8 13:01 main.o
-rw-r--r-- 1 root root 8947 Sep 8 12:58 Makefile
-rw-r--r-- 1 root root 2641 Sep 8 13:01 moc_qsql_mysql.cpp
-rw-r--r-- 1 root root 5940 Sep 8 13:01 moc_qsql_mysql.o
-rw-r--r-- 1 root root 585 Jun 2 04:03 mysql.pro
-rw-r--r-- 1 root root 2412 Sep 8 13:01 qsql_mysql.moc
-rw-r--r-- 1 root root 79112 Sep 8 13:01 qsql_mysql.o
-rw-r--r-- 1 root root 204 Jun 2 04:03 README
To copy to clipboard, switch view to plain text mode
and the following in ../../..//plugins/sqldrivers
[root@localhost sqldrivers]# ll
total 10960
-rwxr-xr-x 1 root root 424302 Jun 2 14:18 libqsqlite2.so
-rwxr-xr-x 1 root root 1601752 Jun 2 14:17 libqsqlite.so
-rwxr-xr-x 1 root root 8602384 Sep 8 13:01 libqsqlmysql.so
-rwxr-xr-x 1 root root 537311 Jun 2 14:18 libqsqlpsql.so
[root@localhost sqldrivers]# ll
total 10960
-rwxr-xr-x 1 root root 424302 Jun 2 14:18 libqsqlite2.so
-rwxr-xr-x 1 root root 1601752 Jun 2 14:17 libqsqlite.so
-rwxr-xr-x 1 root root 8602384 Sep 8 13:01 libqsqlmysql.so
-rwxr-xr-x 1 root root 537311 Jun 2 14:18 libqsqlpsql.so
To copy to clipboard, switch view to plain text mode
Running the following code (having included Qt += sql in the project file)
#include <QCoreApplication>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlError>
#include <QStringList>
#include <QtDebug>
int main( int argc, char **argv )
{
//app.addLibraryPath("/opt/qtsdk-2010.04/qt/plugins/sqldrivers");
qDebug() << db.lastError();
qDebug() << app.libraryPaths();
}
#include <QCoreApplication>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlError>
#include <QStringList>
#include <QtDebug>
int main( int argc, char **argv )
{
QCoreApplication app( argc, argv );
//app.addLibraryPath("/opt/qtsdk-2010.04/qt/plugins/sqldrivers");
qDebug() << QSqlDatabase::drivers();
QSqlDatabase db( QSqlDatabase::addDatabase( "QMYSQL" ) );
qDebug() << db.lastError();
qDebug() << app.libraryPaths();
}
To copy to clipboard, switch view to plain text mode
Produces the following
("QSQLITE")
QSqlError(-1,
"Driver not loaded",
"Driver not loaded") ("/opt/qtsdk-2010.04/qt/plugins")
("QSQLITE")
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE
QSqlError(-1, "Driver not loaded", "Driver not loaded")
("/opt/qtsdk-2010.04/qt/plugins")
To copy to clipboard, switch view to plain text mode
As it is obvious that QMYSQL is still not loaded, I am at a loss as to what to do next. Have spent two days on the net already, looking for solutions.
It seems to me as if the library compiled correctly and that the include path is fine, yet Qt still doesn't pick up the plugin. What could I have missed?
Any help will be greatly appreciated.
Bookmarks