Solved

QT and MySQL

Posted on 2011-03-11
8
877 Views
Last Modified: 2013-11-23
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 (http://www.experts-exchange.com/Database/MySQL/Q_21276641.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

0
Comment
Question by:arjoshi77
  • 3
  • 2
8 Comments
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 35136540
                Hi!

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

Regards,
    Tomas Helgi
0
 
LVL 12

Expert Comment

by:HappyCactus
ID: 35274714
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.
0
 

Author Comment

by:arjoshi77
ID: 35304899
I'm running windows.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 12

Expert Comment

by:HappyCactus
ID: 35312467
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.
0
 

Author Comment

by:arjoshi77
ID: 35313564
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.
0
 
LVL 12

Accepted Solution

by:
HappyCactus earned 500 total points
ID: 35314428
Try install your plugin in the plugin directory under the QT library; or add the plugin path to your application search path:

qApp->addLibraryPath("C:/customPath/plugins");

Open in new window


In this documentation page you'll find many suggestions on how deploy application under windows.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to fix Datetime in MySQL? 4 51
php56-php-mcrypt for rhel7 php56 1 55
The better OS Architecture 13 67
Uploading a CSV Data Import via PHP & MySql 3 34
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question