Help with QMYSQL driver for QT 4.4.0: driver not loaded
Dear,
I have done a fair share of googling and reading post in this forum. However I am still having a problem of the application complaining of "QMYSQL driver not loaded"
Here is what I have:
1) The OS is redhat enterprise kernel 2.6x
2) The OS come loaded with qt 3.6
3) I extract qt 4.4.0 and compiled in a seperate location let's call it $QTDIR, I have compile and run other QT application fine --> suggested that I have the 4.4.0 environment set up correctly.
4) the QTDIR has the following plugins:
$QTDIR/plugins/sqldrivers/libqsqlite.a
$QTDIR/plugins/sqldrivers/libqsqlmysql.a
5) I have QT += sql in the .pro file
6) The following code yield the following error:
int main( int argc, char **argv )
{
QCoreApplication app( argc, argv );
qDebug() << "Sql driver " << QSqlDatabase::drivers();
QSqlDatabase db( QSqlDatabase::addDatabase( "QMYSQL" ) );
qDebug() << db.lastError();
}
The result is :
Sql driver ()
QSqldatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers:
QSqlError(-1, "Driver not loaded", "Driver not loaded");
8) After extensive googling, it all seem to suggest a recompile of mysql plugin, the question is, if i already have the qsqlmysql.a in the plugins/sqldrivers/ do I still need to recompile it? What am I doing wrong?
Please help.
Thanks
khikho
Re: Help with QMYSQL driver for QT 4.4.0: driver not loaded
If it was me, I'd download and install a newer version of QT.
If you read the configure help, it will show you how to make sure QT is configured with MySQL.
Karl
Re: Help with QMYSQL driver for QT 4.4.0: driver not loaded
Thanks for replying,
For the future, I was compiling qt as static library with just the mysql plugin, this explain the present of qsqlmysql.a but not the share library.
A reconfiguring and recompiling of qt as share library and including mysql driver, not just as a plugin, solved the problem.
cheer
khikho
Re: Help with QMYSQL driver for QT 4.4.0: driver not loaded
Quote:
Originally Posted by
khikho
Thanks for replying,
For the future, I was compiling qt as static library with just the mysql plugin, this explain the present of qsqlmysql.a but not the share library.
A reconfiguring and recompiling of qt as share library and including mysql driver, not just as a plugin, solved the problem.
cheer
khikho
I request you to mention the commands used for reconfiguring of qt as share library and including mysql driver.
Re: Help with QMYSQL driver for QT 4.4.0: driver not loaded
If you are wanting a static build:
Code:
[FONT=Arial, sans-serif]# ./configure -platform linux-g++ -prefix /usr/local/qt-4.4-static -static -release -qt-sql-mysql -qt-sql-sqlite -I /usr/include/mysql -L /usr/lib/mysql[/FONT]
You can refer to http://doc.qt.nokia.com/4.4/install-x11.html for more details
Karl