[Qt-interest] database drivers "QMYSQL" connection issues tips
S. Aguinaga
sa_jr at yahoo.com
Fri Mar 13 14:39:19 CET 2009
Hi, thank you Bill.
I've got this far: I compiled the the driver and now I have 3 drivers, but QMYSQL still fails to work.
It's probably just a linking or loading issue:
I know this issue has beaten the death, so the solution must be out there. I will appreciate any help and advice:
1. ~~~~~~~~~~~~~
I'm pretty sure mysql is working, because I can login to it from the command
line and using python.
The following code outputs:
QApplication app(argc, argv);
qDebug() << QSqlDatabase::drivers();
QSqlDatabase db = QSqlDatabase::addDatabase( "QMYSQL" );
qDebug() << db.lastError();
qDebug() << QCoreApplication::libraryPaths();
("QSQLITE", "QMYSQL3", "QMYSQL")
QSqlError(-1, "", "")
("/usr/lib/qt4/plugins", "/home/shared/harpmysql")
// System:
fedora 9
qt4.4.3
// mysql* files under: /usr/lib/
libmysqlclient_r.so -> /usr/lib/mysql/libmysqlclient_r.so.15.0.0
libmysqlclient.so -> /usr/lib/mysql/libmysqlclient.so.15.0.0
libmysqlpp.so.3 -> libmysqlpp.so.3.0.9
libmysqlpp.so.3.0.9
// Makefile LIBS section reads:
LIBS = $(SUBLIBS) -L/usr/lib/mysql -lmysqlclient -lQtSql -lQtGui -lQtCore -lpthread
adding: -L/usr/lib/mysql -lmysqlclient to the LIBS line did not make a diff.
2. ~~~~~~~~~~~~~
After setting: export QT_DEBUG_PLUGINS=1
I got some more details, so if I can get past this ... I'm good to go. Thanks again Bill.
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt4/plugins/inputmethods/libqimsw-multi.so"
keys ("imsw-multi")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt4/plugins/sqldrivers/libqsqlite.so"
keys ("QSQLITE")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so"
keys ("QMYSQL3", "QMYSQL")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so.debug"
"The file '/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so.debug' is not a valid Qt plugin."
not a plugin
("QSQLITE", "QMYSQL3", "QMYSQL")
QSqlError(-1, "", "")
("/usr/lib/qt4/plugins", "/home/shared/harpmysql")
Should I remove the "libqsqlmysql.so.debug" file?
________________________________
From: Bill KING <bill.king at trolltech.com>
To: S. Aguinaga <sa_jr at yahoo.com>
Sent: Sunday, March 8, 2009 4:54:45 PM
Subject: Re: [Qt-interest] Runtime configuration of database drivers
If the mysql plugin is in the plugin directory, then it should
automatically load if you use a database of type mysql. if not, check
your libraries, also, try setting the environment variable
QT_DEBUG_PLUGINS=1, and running your application again.
Hope this helps a bit ;)
Bill.
S. Aguinaga wrote:
> how do you properly load the qmysql driver? I tried ldd filename.so
> and my app still says that the only one running is QSQLlTE
>
> // Sal
> // Chicago, Il
>
> ------------------------------------------------------------------------
> *From:* Bill KING <bill.king at trolltech.com>
> *To:* Robert Hairgrove <evorgriahr at hispeed.ch>
> *Cc:* qt-interest at trolltech.com
> *Sent:* Thursday, January 8, 2009 9:00:01 PM
> *Subject:* Re: [Qt-interest] Runtime configuration of database drivers
>
> Robert Hairgrove wrote:
> > (opensource Qt-4.4.3)
> >
> > Two questions:
> >
> > (1) When a stand-alone application is running on a client's PC, how can
> > the application "know" which databases are already installed? I have
> > configured my compilation for as many databases as are allowed by the
> > opensource version. These are MySQL, ODBC, PostgreSQL and SQLite.
> >
> > The only one of these guaranteed to work on any machine is SQLite
> > because it is compiled into Qt itself. All the others rely on shared
> > libraries which might or might not be there. However, if someone wants
> > to use PostgreSQL, for example, it is available.
> >
> > Do we just try to connect at runtime and catch the error? Try to load
> > the required libraries and see if they fail? Or is it better to provide
> > support for the drivers as plugins?
> >
> >
> I'd do the second, if there are missing libraries, it seems to silently
> fail to load the plugin on unix at least. Not sure how it goes on windows.
>
> --
> Bill King, Software Engineer
> Qt Software, Nokia Pty Ltd
> Brisbane Office
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com <mailto:Qt-interest at trolltech.com>
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
Bill King, Software Engineer
Qt Software, Nokia Pty Ltd
Brisbane Office
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090313/1e505840/attachment.html
More information about the Qt-interest-old
mailing list