Link to home
Start Free TrialLog in
Avatar of arjoshi77
arjoshi77

asked on

QT and MySQL

Hello:

I have mysql 5.x and QT 4.x installed on Suse Linux. I would like to access mysql through QT. I searched for a solution on experts exchange (https://www.experts-exchange.com/questions/21276641/QT-and-mysql.html). The accepted solution contains two links. One link points to prepared statements (which is irrelevant ) and the other link seems to be broken

I tried the following code: but got the output as:

("QSQLITE",QPSQL7","QPSQL")


would apreciate any help.


#include <QCoreApplication>
#include <QtSql>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    qDebug() << QSqlDatabase::drivers();

    return a.exec();
}

Open in new window

Avatar of Tomas Helgi Johannsson
Tomas Helgi Johannsson
Flag of Iceland image

                Hi!

This link is probably useful to you
http://cartan.cas.suffolk.edu/oopdocbook/opensource/qmysqldatabase.html

Regards,
    Tomas Helgi
MySql is not enabled by default in many environment, like macOSX.
Did you installed the package or compiled all the QT library by yourself? In the first case, see if there is some additional package available in your distro, otherwise, follow these instructions:

http://www.pikopong.com/blog/2009/07/22/how-to-enable-mysql-support-in-qt-sdk-for-linux/

Hope that helps.
Avatar of arjoshi77
arjoshi77

ASKER

I'm running windows.
You wrote that you were on SuSE linux.
the QT documentation has a section (here) with the step-by-step installation of the mysql driver on windows (both for mingw and vs libraries).
Remember just to adjust the library version accordingly your needs, if you are using 4.7 (recommended) change 4.6.3 with 4.7.2...
If you have some trouble, don't hesitate to ask.

hope that helps.
thanks cactus for that link. Yes, I was on susue but have shifted to windows now. I executed what was mentioned in the linkto the letter and successfully have built the plugin. HOwever, I am now having trouble using the plugin. I understand that the plugins directory must be below relative to the executable. I tried doing that but get no positive answer on the fact that QMYSQL has been loaded.
ASKER CERTIFIED SOLUTION
Avatar of HappyCactus
HappyCactus
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial