LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-26-2013, 03:09 PM   #1
lingodeles
LQ Newbie
 
Registered: Jan 2013
Location: Morocco
Distribution: Fedora
Posts: 5

Rep: Reputation: Disabled
Connecting MySQL database to Qt under Linux


Hi. Thank you for that!
I'm programming a Qt application under Linux Fedora, and i want to connect it with a MySQL database.
I have the QMySQL, MySQL and Qt 4.8 . I learned that i have to compile the driver. I've try many time to but still not yet. I could not use qmake command. It seems that it isn't a shell command!!!
So could someone helps me to do it. I'm stopped here since 2 weeks!!
 
Old 01-26-2013, 03:25 PM   #2
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 651

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by lingodeles View Post
I have [...] Qt 4.8 .
[...]
It seems that it isn't a shell command!!!
Do you also have qt-devel package?
 
Old 01-26-2013, 04:06 PM   #3
lingodeles
LQ Newbie
 
Registered: Jan 2013
Location: Morocco
Distribution: Fedora
Posts: 5

Original Poster
Rep: Reputation: Disabled
Yes i have. but i dont know how to use it...
 
Old 01-27-2013, 02:42 AM   #4
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 651

Rep: Reputation: 269Reputation: 269Reputation: 269
Can you post the exact command(s) you are trying to run and whatever error you are getting?
 
Old 01-27-2013, 04:40 AM   #5
lingodeles
LQ Newbie
 
Registered: Jan 2013
Location: Morocco
Distribution: Fedora
Posts: 5

Original Poster
Rep: Reputation: Disabled
Of course!
command:
qmake "INCLUDEPATH+=/usr/lib64/mysql/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
and error:
bash: qmake: command not found...
Similar command is: 'make'

Then i've try:
make "INCLUDEPATH+=/usr/lib64/mysql/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro

and the error becomes:
ake: *** No rule to make target `mysql.pro'. Stop.

Seriouly i didn't understand anything!
 
Old 01-27-2013, 05:54 AM   #6
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 651

Rep: Reputation: 269Reputation: 269Reputation: 269
Do you know where qmake is installed on your system? May be something like

Code:
/usr/lib/qt4/qmake
You'll have to either specify the full path or add the directory to your $PATH.
 
Old 01-27-2013, 06:32 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,621

Rep: Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527
Fedora, qt-devel-4.x.x :

/usr/lib/qt4/bin/qmake , and /usr/bin/qmake-qt4

You can get a binaries file list with :
$ rpm -ql qt-devel | grep bin
 
Old 01-27-2013, 07:02 AM   #8
lingodeles
LQ Newbie
 
Registered: Jan 2013
Location: Morocco
Distribution: Fedora
Posts: 5

Original Poster
Rep: Reputation: Disabled
Yes i know it.
It is in: /usr/lib64/qt4/bin/qmake.
I specified the full in the command like this:

/usr/lib64/qt4/bin/qmake "INCLUDEPATH+=/usr/lib64/mysql/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro

and it gives me a new error:

Cannot find file: mysql.pro.

Which "mysql.pro"? Must i download it again?
I've already downloaded the qt-devel package and also the QMysql...
 
Old 01-27-2013, 09:22 AM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,621

Rep: Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527Reputation: 2527
*


What exactly is it you are trying to compile ? ?
 
Old 01-27-2013, 09:41 AM   #10
lingodeles
LQ Newbie
 
Registered: Jan 2013
Location: Morocco
Distribution: Fedora
Posts: 5

Original Poster
Rep: Reputation: Disabled
in fact i want just to connect my Qt application with a MySQL database. For make this connection, i read that i must build the driver in local, that's why i'm doing all that: i really need helps and seriously, even if you have an easier solution, please give it to me. I'm going to be crazy with this Qt/MySQL connection!!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] problems connecting to mysql database mark_alfred Linux - Software 4 08-26-2010 03:58 AM
Connecting to central Mysql database server winairmvs Linux - Software 9 09-18-2009 08:04 AM
connecting to a MySQL database hsa Linux - General 3 09-16-2005 06:34 AM
connecting to MYSQL remote database opsraja Linux - Software 1 02-18-2005 05:52 AM
Connecting Mysql Database on remote server akamol Programming 4 10-16-2003 11:46 AM


All times are GMT -5. The time now is 08:20 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration