[Qt-interest] Using Qt with both MySQL embedded and server

Support Lists supportlists at qlands.com
Wed Dec 9 12:56:08 CET 2009


Hi,

Hi, I'm writing an application to connect to a MySql embeeded database. 
However, I would like to keep both embedded and server drivers.

I saw a post by Adam Warrington on April 2003 about this and I did:

1 - Copy of the server driver into another directory called: 
mysql_embedded.
2-  Changed the target from qsqlmysql to libqsqlmysqle (to create a 
different .so)
3-  Executed: qmake -o Makefile 
"INCLUDEPATH+=/usr/local/mysqlembedded/include/mysql" 
"LIBS+=-L/usr/local/mysqlembedded/lib/mysql -lmysqld" mysql.pr  t
4- Make it (all fine) and then I copied the libqsqlmysqle.so to the 
/plugins/sqldrivers directory.

In my test application I have:

     QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQLD");
     db.setHostName("");
     db.setDatabaseName("test");
     db.setUserName("");
     db.setPassword("");
     bool ok = db.open();
     if (ok == true) qDebug() << "Fine!"; else qDebug() << "Error!";

After executing I have the following error:

QSqlDatabase: QMYSQLD driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL3 QMYSQL

Some questions:
1 -What do I need to change in order to load the QMYSQLD driver?
2- How do I need to setup QSqlDatabase to indicate the directory where 
the embedded database is?

Many thanks,

Carlos Q.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091209/0b51e461/attachment.html 


More information about the Qt-interest-old mailing list