[Qt-interest] mySQL plugin

Shaun van Wyngaard (Home) shaungvw at gmail.com
Tue Nov 17 19:37:12 CET 2009


Thank you for your advice. I did as you advised
Copied the directory "opt"
from
    "C:\Program Files\MySQL\MySQL Connector C 6.0.2\lib"
to
   "C:\Qt\2009.04\qt\src\plugins\sqldrivers\mysql"

Then ran the commands given

C:\Qt\2009.04\qt\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=.\\" "LIBS+=.\
\libmysql.lib" mysql.pro
C:\Qt\2009.04\qt\src\plugins\sqldrivers\mysql>mingw32-make
mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `C:/Qt/2009.04/qt/src/plugins/sqldrivers/mysql'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -
DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"." -I"..\..\..\..\include\ActiveQt" -I"
tmp\moc\debug_shared" -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\
main.o main.cpp In file included from main.cpp:44:
../../../sql/drivers/mysql/qsql_mysql.h:52:19: mysql.h: No such file or directory
In file included from main.cpp:44:../../../sql/drivers/mysql/qsql_mysql.h:107: error: expected `)' before '*' token
mingw32-make[1]: *** [tmp/obj/debug_shared/main.o] Error 1
mingw32-make[1]: Leaving directory `C:/Qt/2009.04/qt/src/plugins/sqldrivers/mysql'
mingw32-make: *** [debug-all] Error 2
C:\Qt\2009.04\qt\src\plugins\sqldrivers\mysql>

I had to edit the mysql.pro file and type in the exact directory for it to find the 2 files (.h & .cpp)
I also had to edit the main.cpp file to explicitely enter in the directory, and then another file too! (Sorry lost track)
I also had to copy libmysql.lib to /mingw/lib for it to find it.
I did eventually get a dll file (debug) but the release one didn't want to work.
At some point I will reinstall everything again, and see if I can iron out the issues why it didn't work the first time.
Now when I transferred the  executable to the computer it was to run from, I got an error

runtime error
this application has requested the runtime to terminate it unusually
Contact the...and so on.

I copied all the dll files I could find across, the newly created qsqlmysql4d.dll, libmysql.dll (this one I think might have come from a previous attempt doing it someone else way)

I then installed the full Qt SDK onto the computer, and the mysql connector package I had previously downloaded, again, no luck, yet it runs fine on the first computer where it was coded from.

If all you are looking for are these two dll files (debug and release), why does someone not just make them available for download. EVERY thread I read on getting this plugin working has a different way to do it. I really don't understand why it is so complicated! Like I mentioned, I had to go into a few files and type the exact path to locate files, and then the release version gave errors anyway in creating it! Enough to make me throw my hands up. Surely it needs to be easier? I want to program, not get frustrated because now I have to first make my plugins! (Ok, enough winging!)

Thanks,
Shaun
(Sorry it all looks so messy)



From: mmiacca 
Sent: Monday, November 16, 2009 9:42 PM
To: Shaun van Wyngaard (Home) 
Cc: qt-interest 
Subject: Re: [Qt-interest] mySQL plugin


First you need download the c connector for mysql, the recent is "mysql-connector-c-6.0.2-win32", install it and observe the destination folder.

After install i:
a) copy the header folder from the destination of the instalation to c:\qt\qtsdk-2009.04\qt\src\plugins\sqldrivers\mysql.
b) copy libmysql.lib from the destination of the instalation to c:\qt\qtsdk-2009.04\qt\src\plugins\sqldrivers\mysql.

Open a qt command prompt and:
a) qmake "INCLUDEPATH+=.\\" "LIBS+=.\\libmysql.lib" mysql.pro
b) nmake or mingw32-make (mingw32-make is installed with open source of qt)
c) nmake install or mingw32-make install (this copy the dll to the c:\qt\qtsdk-2009.04\qt\plugins\sqldrivers
d)You get qsqlmysql4.dll

For the release:
a) qmake "INCLUDEPATH+=.\\" "LIBS+=.\\libmysql.lib" mysql.pro
b) nmake or mingw32-make release (mingw32-make is installed with open source of qt)
c) nmake install or mingw32-make install (this copy the dll to the c:\qt\qtsdk-2009.04\qt\plugins\sqldrivers
d)You get qsqlmysql4d.dll

d) REMEMBER, if your proyect is builded in debug mode the mysql dll must be build in debug mode, if your proyect is builded in release mode the mysql dll must be in release mode.

hope this help

Shaun van Wyngaard (Home) escribió: 
  I saw another posting on installing a plugin for Qt, and not wanting to steal the post, I have to ask a similar question.

  Having installed the SDK 2009.04, I now want to install the mysQL plugin, but everything I have read so far leads me to believe that the people manually built the libraries themselves using qmake/make/nmake. (Sorry, I really don't know what is happening here, as I say I did mine through the SDK and this did everything for me)

  I now want to install the mySQL plugin, and so is it as simple as going to the directory in question and just running qmake. then nmake?
  Not knowing too much about plugins, it seems it is the dll file that is needed, so why not just download it and place it in the correct directory?

  Please forgive my ignorance on this subject matter, I know about database programming, just not how plugins work.

  Shaun
------------------------------------------------------------------------------
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091117/c3f85ddd/attachment.html 


More information about the Qt-interest-old mailing list