PDA

View Full Version : Connection to MySQL



giriuvce
27th May 2011, 13:52
Hi, I am using Qt 4.7.2 in Simulator whic ll run in my W Vista. I ve been trying to connect to MySQL Server 5.1. Since i was getting "Driver not loaded" error i tried the steps in trolltech (http://doc.trolltech.com/4.4/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows). I am getting both make and nmake command not found.
I am new to this programming. Please help me to connect to the database. Guide me from the first step. Any database if i am able to connect easily that is very helpful to me. Thank u.

cincirin
27th May 2011, 15:53
1. download mysql-connector-c-noinstall-6.0.2-win32 binary package from mysql downloads.
2. open %QTDIR%\src\plugins\sqldrivers\mysql\mysql.pro in QtCreator
3. add LIBS and INCLUDEPATH in mysql.pro to match with your mysql-connector-c-noinstall-6.0.2-win32 path
4. after mysql.pro is succesfully build, copy the qsqlmysqld4.dll in %QTDIR%\Desktop\...etc...\plugins\sqldrivers (there should already be qsqlite4.dll)
5. copy libmysql.dll in %QTDIR%\Desktop\...etc...\bin

that's all

giriuvce
28th May 2011, 13:07
Sorry to ask this sir. Where can i get qsqlmysqld4.dll. Other steps i did successfully. Thank u:)

Lykurg
28th May 2011, 15:28
You'll find qsqlmysqld4.dll where you run make at the 4th step. Look at the debug/release folder.

SIFE
29th May 2011, 02:29
%QTDIR%\src\plugins\sqldrivers\mysql\release
Production version, smaller then debug version.

%QTDIR%\src\plugins\sqldrivers\mysql\debug
Debug version.

giriuvce
31st May 2011, 06:29
[tmp/moc/release_shared/qsql_mysql.moc] error 1
I'm getting this error when i build. Really, I lost my hope to connect to mysql server. I tried many suggestions in different links. 1ce again i want to make u clear that i'm running Qt 4.7.2 Simulator. Thank u for reply.

giriuvce
1st June 2011, 15:15
The above error comes when i build using qtcreator.
I found the same error when i run in the command prompt in this link.
http://www.siteduzero.com/forum-83-621857-p1-comment-connecter-qt-a-une-bdd-mysql.html
I think they have solved this problem. But i didnt understand their language.

falconium
14th July 2011, 21:13
The above error comes when i build using qtcreator.
I found the same error when i run in the command prompt in this link.
http://www.siteduzero.com/forum-83-621857-p1-comment-connecter-qt-a-une-bdd-mysql.html
I think they have solved this problem. But i didnt understand their language.

He had problem with INCLUDEPATH parameter due to missing backslash after C:.
If you post your printout of error and the command you try to give, then we might know more to give you some solution.

Gokulnathvc
18th July 2011, 08:57
I am getting this error...error: 'my_ulonglong' does not name a type. While following the above steps.

ChrisW67
19th July 2011, 06:59
Then you almost certainly skipped step 3 or got the values wrong.

Greeshma
12th November 2011, 05:49
i'm getting an error when i build the .pro.
It says qsqlmysqld4.dll not found. What shud i do?

Added after 17 minutes:

i had given a wrong path. Now it says -llibmysql not found
I've been tryin a lot of stuff but cant build d plugin properly, wat do i have to do?

deepal_de
22nd January 2012, 17:01
hi,

well this steps worked fine.


1. download mysql-connector-c-noinstall-6.0.2-win32 binary package from mysql downloads.
2. open %QTDIR%\src\plugins\sqldrivers\mysql\mysql.pro in QtCreator
3. add LIBS and INCLUDEPATH in mysql.pro to match with your mysql-connector-c-noinstall-6.0.2-win32 path
4. after mysql.pro is succesfully build, copy the qsqlmysqld4.dll in %QTDIR%\Desktop\...etc...\plugins\sqldrivers (there should already be qsqlite4.dll)
5. copy libmysql.dll in %QTDIR%\Desktop\...etc...\bin



but when i run my app its says "QSqlDatabase: QMYSQL driver not loaded" :(

KillGabio
23rd January 2012, 02:59
i had to erase every wrong step i made to actually generate all the files...i had the same problem with the nmake...i m using minGW so instead of nmake i have to run mingw32-make and voila everything went ok...

http://www.qtcentre.org/threads/46960-how-to-open-a-OCI-db-connection?p=212132&highlight=#post212132

maybe this helps...