PDA

View Full Version : MySql plugin driver issues



stevey
18th September 2006, 03:38
Hi,

I've been having some issues with MySql and Qt 4.
I managed to get the plugin compiled without any hassles under 4.1.4 on my home machine.
That machine does have MySql 5 running as a system service.
I wrote a test app which calls QSqlDatabase::drivers() so I can confirm the successful detection of the compiled plugin.
QMYSQL appears in my list, yay!

On another PC I use at work, I successfully built the plugin using the exact same steps and no errors occurred.
But, when I run the test app the driver won't appear.

I've tried doing it manually as described in the Qt documentation, as well as a complete Qt rebuild passing -plugin-sql-mysql and -qt-sql-mysql as an argument, yet it makes no difference. (By the way, I did mod the .pro file giving the location of the headers and lib before running configure.exe).

Next, I tried simply copying my entire Qt folder from home to work, then ran the test app.
I had compiled ODBC as well on the home build.
These ODBC drivers came up at work, but the QMYSQL driver didn't appear.

Why, given an identical Qt build would the QMYSQL driver not be detected?
I'm not running MySql at work but I can't see why that would matter.
I've also tried this with 4.2 snapshots but get the same issue.

Any ideas?


Steve

ksqt
18th September 2006, 04:28
".......
I'm not running MySql at work but I can't see why that would matter......"

How did you build the mysql plugin without mysql on the machine?

stevey
18th September 2006, 04:54
I had the no-install version extracted to C:
then I was able to reference the headers and libs.

What I mean is it's not running on the machine.

ksqt
18th September 2006, 05:02
I had the no-install version extracted to C:
then I was able to reference the headers and libs.

What I mean is it's not running on the machine.

Ah, I see I misunderstood you.

"(By the way, I did mod the .pro file giving the location of the headers and lib before running configure.exe)"
Can you explain me what you did here? Sometimes I have problems with MySQL also.

stevey
18th September 2006, 05:33
Hi,

I opened C:\Qt\4.2.0-snapshot-20060801\src\plugins\sqldrivers\mysql\mysql.pro
and added these lines:


INCLUDEPATH += c:\MySQL\include
LIBS += c:\MySQL\lib\opt\libmysql.lib


Then I ran configure.exe and nmake.

The way I understand it is that the plugin system scans the plugins\sqldrivers for all dynamic libraries matching the sql plugin interface (and build number).
Given that my qsqlmysql dll files are feshly built into the correct place, why wouldn't Qt know about them?
Especially, the fact that I copied a build directory where it worked on another machine, I can't see why it wouldn't work here given it's the same enviroment.


Thanks for the reply,

Steve York

ksqt
18th September 2006, 06:23
Sorry, I could not actually help you, but I was curious as to what your problem was, etc...

I am going to try rebuild Qt using your above mentioned method to build the plugin. Did you build -static or -shared? And what was the all configures for configure...?

stevey
18th September 2006, 06:26
On both machines, I simply did 'configure.exe -plugin-sql-mysql' (Well on the home one I had ODBC going as well) so I let it do the defaults for everything else.

ksqt
18th September 2006, 06:38
Out of curious, how many header files have you in your include directory for mysql?

stevey
18th September 2006, 06:53
There are 23 files in c:\MySQL\include
The version I'm building against is 5.0.24a-win32

ksqt
18th September 2006, 06:58
ok..identical here....22 headers and one .def

stevey
20th September 2006, 07:24
Right,

I've recompiled Qt with QT_DEBUG_COMPONENT defined.
When I run my test app, I get the following comments when Qt scans the mysql dll files


QFactoryLoader::QFactoryLoader() looking at "C:/Qt/4.2.0-snapshot-20060801/plugins/sqldrivers/qsqlmysql.dll"
not a plugin

Can anyone explain how this could possibly NOT be a plugin?
Especially given that it worked fine as a plugin on one machine, then when copied to another machine (without recompiling) it doesn't appear as a plugin?

What this implies to me is that the library doesn't implement an sql plugin, but it does.
So I just can't understand how this is supposed to work.


Thanks,

Steve York

jacek
20th September 2006, 14:45
Especially given that it worked fine as a plugin on one machine, then when copied to another machine (without recompiling) it doesn't appear as a plugin?
Do you use the same compiler on both machines?