Sunday, June 22, 2014

Qt MySQL Driver


Next step in the project: get a databaseconnection to store / retrieve the data. Didn't go as smoothly as planned. The following short post is simply a reminder for future reference. Comments are welcome!


Read the Qt Documentation, install the Qt Sourc, read the QtCentre information.

Steps to compile the Qt MySQL Driver on a Debian platform

  • go to the folder QtSDK/QtSources/4.7.3/src/sql/drivers/mysql/
  • edit the file qsql_mysql.h and change the "#include <mysql.h>" into "#include </usr/include/mysql/mysql.h>"
  • go to the folder QtSDK/QtSources/4.7.3/src/plugins/sqldrivers/mysql/
  • run qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro as stated in the Qt Documentation.
  • run make
  • if /usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so already exist, make a backup
  • run sudo make install
In your .pro file, add the line "QT += sql".

Download MySQL Connector/C++ here or use the sudo apt-get.

Steps to compile the Qt MySQL Driver on a Win32- platform


(work in progress)

...

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...