PDA

View Full Version : qt4.3.1 mysql problem



twells55555
5th October 2007, 20:38
Hi,

I have been using qt 4.2.2, mingw, and mysql 5.0 for some time with no problems. Recently I tried upgrading to qt 4.3.1 and now mysql is no longer functioning properly. I followed the steps below and everything seemed to go fine. No errors and I have the qsqlmysql4.dll and libqsqlmysql4.a files in my qt/4.3.1/plugins/sqldrivers directory as expected.

My code builds without any errors but the problem is than now when I execute it, a message box pops up immediately saying:

"The procedure entry point mysql_affected_rows@4 could not be located
in the dynamic link library libmysql.dll"

I've never seen this message before and I'm not sure what is causing it now. Nothing has changed as far as mysql is concerned. I've tried rebuilding (successfully) from scatch but the same thing happens everytime. I'm not sure what I am doing wrong and any help would be appreciated.

thanx,

tim



************************************************** *********

Open a Qt Command Prompt and go to wherever you installed the MySQL server (C:\Program Files\MySQL\MySQL Server 5.0 is the default location).

Goto the sub-directory lib/opt and run reimp libmysql.lib to produce the liblibmysql.a file. This is the import library to use with MinGW.

Go to %QTDIR%/src/plugins/sqldrivers/mysql.
Run the following command: qmake -o Makefile "INCLUDEPATH+=C:\Progra~1\MySQL\MySQLS~1.0\include" "LIBS+=C:\Progra~1\MySQL\MySQLS~1.0\lib\opt\liblibm ysql.a"
mysql.pro

Run make - this should build the qsqlmysql.dll and libqsqlmysql.a files in the %QTDIR%/plugins/sqldrivers directory.

Copy the libmysql.dll file from the MySQL installation's bin directory to a directory in %PATH% (e.g. %QTDIR%/bin).

Now the plug-in should load properly. You may have to empty the plug-in cache before everything works though.

************************************************** *******

jpn
7th October 2007, 15:46
Perhaps you have old version of Qt in PATH?

twells55555
8th October 2007, 16:56
JPN,

Thanks for the reply. I checked the paths already and they all point to 4.3.1. Just to be sure I uninstalled 4.2.2 and removed all path references, but I still got the same error. Also, when I remove the mysql dll from 4.3.1, I get a can't find dll type error, so it seems to be looking in the right place. Others say they have got this working with 4.3.1 so it must be possible, but I'm running out of guesses....

I'm wondering if there could be some registry keys left over from 4.2.2 giving me trouble, or if there is a switch I am forgetting to set to use the mysql plug-in with 4.3.1 which I had set with 4.2.2...it was a long time ago that I set that up.

One other thing....the last line of the instructions I followed says:

"You may have to empty the plug-in cache before everything works though."

I don't know how to empty the plug-in cache....do you?

tim

jpn
8th October 2007, 17:03
One other thing....the last line of the instructions I followed says:

"You may have to empty the plug-in cache before everything works though."

I don't know how to empty the plug-in cache....do you?

http://doc.trolltech.com/4.3/plugins-howto.html#the-plugin-cache

twells55555
8th October 2007, 20:30
Yes, I've read that link on the plugin cache but I'm not sure exactly how to do it and I'm not very exerienced with the registry. Am I supposed to delete those keys in the registry so that QT can reinstall them?

tim

jpn
8th October 2007, 21:26
Yup, exactly. You can use regedit.exe to remove appropriate entries.