Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, December 2007
[Win32] MySQL plugin built, but not available


Message 1 in thread

I'm using qt-win-opensource-src-4.3.2.

I have succeeded in builiding the MySQL plugin against
a stock MySQL 5 distribution from www.mysql.com under
VSC++ 2005

In the plugins\sqldrivers directory I have:

qsqlite4.dll etc
qsqlited4.dll etc
qsqlmysql4.dll etc
qsqlmysqld4.dll etc

However, I cannot load the QMYSQL plugin and the following
program reports QSQLITE as the only available plugin:

int main (int argc, char *argv[])

{
    QCoreApplication qapp(argc, argv);

    qDebug() << QSqlDatabase::drivers();
}

Can anyone suggest why the MySQL plugin is not available ?

-- 
 [ signature omitted ] 

Message 2 in thread

Hello Stephen,
first you should change your pro file for the plugin to prevent the 
embedding of the manifest into the dll -> see deploying QT under windows 
with vs 2005.

Second, your mysql dll should be in the path, because the plugin uses 
libmysql.dll.

third, your path to the plugin should be known by qt, either use qt.conf 
or use addLibraryPath() to your main.cpp right after the declaration of 
the Application object.

i.e

QApplication a(argc, argv);
a.addLibraryPath("./plugins");
a.addLibraryPath("some other path")....

Next use a Operation system starting from windows 2000. All earlier OS 
are no longer supported by Microsoft.


Stephen Collyer schrieb:
> I'm using qt-win-opensource-src-4.3.2.
> 
> I have succeeded in builiding the MySQL plugin against
> a stock MySQL 5 distribution from www.mysql.com under
> VSC++ 2005
> 
> In the plugins\sqldrivers directory I have:
> 
> qsqlite4.dll etc
> qsqlited4.dll etc
> qsqlmysql4.dll etc
> qsqlmysqld4.dll etc
> 
> However, I cannot load the QMYSQL plugin and the following
> program reports QSQLITE as the only available plugin:
> 
> int main (int argc, char *argv[])
> 
> {
>     QCoreApplication qapp(argc, argv);
> 
>     qDebug() << QSqlDatabase::drivers();
> }
> 
> Can anyone suggest why the MySQL plugin is not available ?
> 

--
 [ signature omitted ] 

Message 3 in thread

peter wrote:
> Hello Stephen,
> first you should change your pro file for the plugin to prevent the
> embedding of the manifest into the dll -> see deploying QT under windows
> with vs 2005.

I can't find the document that you mention here - do you have
a link ? It doesn't seem to be in Qt Assistant.

> Second, your mysql dll should be in the path, because the plugin uses
> libmysql.dll.

In the PATH variable ? If so, I've added the appropriate folder,
but it makes no difference.

> third, your path to the plugin should be known by qt, either use qt.conf
> or use addLibraryPath() to your main.cpp right after the declaration of
> the Application object.

This should be fine as the MySQL plugin is in the same place
as the SQLITE plugin, which is found.

BTW, this seems to a Win32 specific problem - the plugin
is found correctly using identical code compiled on a Linux box.

-- 
 [ signature omitted ] 

Message 4 in thread

Stephen,


Stephen Collyer schrieb:
> peter wrote:
>> Hello Stephen,
>> first you should change your pro file for the plugin to prevent the
>> embedding of the manifest into the dll -> see deploying QT under windows
>> with vs 2005.
> 
> I can't find the document that you mention here - do you have
> a link ? It doesn't seem to be in Qt Assistant.

In Assistant is a "Index" Tab. Give the word "DEPLOY" a chance.... Or 
search online...
> 
>> Second, your mysql dll should be in the path, because the plugin uses
>> libmysql.dll.
> 
> In the PATH variable ? If so, I've added the appropriate folder,
> but it makes no difference.
> 
This is normally enough (on my configuration, this works well...). Add 
the location of libmysql.dll to path or copy this file into the path.

>> third, your path to the plugin should be known by qt, either use qt.conf
>> or use addLibraryPath() to your main.cpp right after the declaration of
>> the Application object.
> 
> This should be fine as the MySQL plugin is in the same place
> as the SQLITE plugin, which is found.
> 
> BTW, this seems to a Win32 specific problem - the plugin
> is found correctly using identical code compiled on a Linux box.
> 
As everything works here under Win32 (development machine + virgin PC 
without any dev. tools on it, just deployed ....), I no longer have any 
idea.

Best would be to recreate QT either with uninstall/install task to have 
a clean install, or with a nmake clean on commandline. I suggest, you 
copy the include files and the lib of mysql to a separate dir without 
spaces in the name of that dir. Then start your configure with 
-sql-plugin-mysql -L \mypathtomysqllib -I \locationofmysqlheaders and 
not with static building ! Don't forget to modify the mysql.pro file 
under $QTDIR$/src/plugins/sqldrivers/mysql/ with the 
CONFIG-=embed_manifest_dll switch, after configure and do not forget to 
run QMAKE after that  !
then start nmake sub-src from $QTDIR$/, that should do the rest...

--
 [ signature omitted ]