PDA

View Full Version : building a plugin for MySql



pcaeiro
30th July 2009, 16:41
Hello,


I'm starting with Qt4.5 and i am using QtCreator in ubuntu.

I want to develop an application that will interact with a Mysql DB, and i am having troubles with that...

In my /usr/lib/qt4/plugins/sqldrivers i only have libqsqlite.so so i gess i need to build one for mysql. I have searched already and if i understood right i only found solutions that need to repeat all the installation process for Qt.(e: http://doc.trolltech.com/4.5/sql-driver.html#qmysql)

Is it possible to build a plugin QMySql for MySql in a diferent way?

thanks in advance,

Paulo

wdezell
31st July 2009, 20:29
If you're using the version installed via your OS's package manager, the MySQL plugin will be an installable module you can select and install with a few clicks. Sorry, not an Ubuntu user so I can't tell you specifically what to run to do the job. Maybe apt-get, I'm not sure.

Be advised that the MySQL driver provided with Qt 4.5 appears to be buggy and broken (apparently tries to execute all queries first as 'prepared queries' and does not correctly fall back for queries unsupported by the 'prepared' protocol -- you wind up getting MySQL 1295 errors from QSqlQuery::lastError() when there should be no error).

If you are going to do MySQL work with Qt for now I would encourage you to ditch 4.5 and fall back to 4.4.3. Installation isn't that hard and only requires you set your path to its bindir to use.

The following worked for me:

as regular user

./configure -qt-sql-mysql -system-sqlite

as regular user

make

as root

make install

pcaeiro
5th August 2009, 11:07
First of all, thanks for the attention,

well i have solved the problem before i have the chance to read your answer.

All i have done was generate the plugin QMySql from the qt source code and than copy it to my qt SqlDrivers folder and it works...

:D

Paulo