Connection to MySQL

 

ast's picture

Hi - I downloaded OpenRPT because it said it was focused on PostgresSQL, but with some work it could also connect to other databased, a/o MySQL. I can't find a way to do that thought. Is it possible? And, if so, how?

An answer would be highly appreciated, thanks

 
idiallo's picture
Offline
Joined: 11/12/2007

OpenRPT should be able to connect to any Qt-supported database throught the Qt plugin mecanism, including MySQL. For Windows, you would have to add the required dll (qsqlmysql4.dll for instance) in the /sqldrivers directory of the application. Since the only database dlls provided with OpenRPT are PostgreSQL and ODBC, you might have to get/build them from a Qt install. See the Qt doc: http://doc.trolltech.com/4.3/sql-driver.html

 
ast
ast's picture
Offline
Joined: 01/20/2008

OK. Thanks. I work with OSX. I'll have look there for an OSX driver.

 
samir's picture
Offline
Joined: 10/08/2009
QSqlDatabase: QMYSQL driver not loaded

Environment: Platform: Windows XP, Qt Creator Ide 4.5.2

I prepared qsqlmysql4.dll as instructed in http://doc.trolltech.com/4.3/sql-driver.html#how-to-build-the-qmysql-plu.... Then copied it in "D:\Program-Files\Qt\2009.03\qt\plugins\sqldrivers". But the line "QSqlDatabase myDb = QSqlDatabase::addDatabase("QMYSQL")" gives the below error:

QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC

What else to do?

 
toroman's picture
Offline
Joined: 10/10/2009
So I guess your problem is

So I guess your problem is not with OpenRPT but with your environment setup.

Do you have libmySQL.dll in your PATH? Or at all? It comes with MySQL...

When your Qt Creator starts working with QMYSQL then you are on a good way to make things work.

I had my Qt set-up to work with MySQL before installing OpenRPT, and still had trouble, but I solved it too... (I actually recompiled release version of OpenRPT and copied new exe files to the OpenRPT folder together with needed dll's from Qt\2009.03\qt\bin). I also copied qsqlmysql4.dll to the sqlplugins folder of OpenRPT.

Hope this helps....

 

mead