PDA

View Full Version : MySQL driver , I have, it still not loaded



bigkoma
30th April 2009, 17:19
Hi,

I make MySQL driver , I have in :


C:\Qt\2009.02\bin\sqldrivers

2009-04-01 15:53 2*359*296 libmysql.dll
2009-04-22 10:58 2*168 libqsqlite4.a
2009-04-22 10:58 2*178 libqsqlited4.a
2009-04-30 18:01 2*182 libqsqlmysql4.a
2009-04-30 18:00 2*192 libqsqlmysqld4.a
2009-04-22 10:57 2*178 libqsqlodbc4.a
2009-04-22 10:57 2*182 libqsqlodbcd4.a
2009-04-15 14:16 347*648 qsqlite4.dll
2009-04-29 18:42 2*793*327 qsqlited4.dll
2009-04-30 18:01 81*920 qsqlmysql4.dll
2009-04-30 18:00 1*587*413 qsqlmysqld4.dll
2009-04-22 10:57 152*576 qsqlodbc4.dll
2009-04-22 10:57 1*593*196 qsqlodbcd4.dll

But driver still can't load :


QSqlDatabase: QMYSQLDriver driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC

I use QTCreator.

---- Edit ----

configure -qt-sql-mysql :


...
Sql Drivers:
ODBC....................no
MySQL...................yes
OCI.....................no
PostgreSQL..............no
TDS.....................no
DB2.....................no
SQLite..................plugin (qt)
SQLite2.................no
InterBase...............no
...

MarkoSan
30th April 2009, 17:55
Try to copy mysql files to %QTDIR%\bin directory, it worked for me...

bigkoma
30th April 2009, 18:05
Try to copy mysql files to %QTDIR%\bin directory, it worked for me...

:/ no, it dosn't work . I still have error :


QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC

tranfuga25s
7th May 2009, 21:45
make shure that you have the libs and headers from mysql.com whithin the same directory that the aplication is executed

bigkoma
7th May 2009, 23:33
Hi , I recompile all QT library in QTCreator, but before I :

1. Copied files from :
C:\Program Files\MySQL\MySQL Server 5.1\include and
C:\Program Files\MySQL\MySQL Server 5.1\lib\opt to
C:\Qt\4.5.1\src\plugins\sqldrivers\mysql

2. I edit:
C:\Qt\4.5.1\src\plugins\sqldrivers\mysql\mysql.pro and in line were is :
LIBS *= -llibmysql

change to
LIBS *= -libmysql


3. You must check that you have a files :

libmysql.a
libmysql.dll
libmysql.def
because in many tutorials is create different file name like : liblibmysql

4. In QTDir run :
configure -qt-sql-mysql

5. I opened in QTCreator file:
C:\Qt\4.5.1\projects.pro and I click compile.

You didn't must wait to end ,because you only need wait to a moment when all sql driver is end compiled. For safe you wait to end :)

I hope that you understand me :)

wysota
9th May 2009, 09:27
Do you have Qt compiled in debug or release mode?

QAmazigh
9th May 2009, 09:49
i have the same problem with QIBASE !
but QMYSQL work fine with me :)
it's easy to make it working but under linux :( and i see you are using windows !

good luck .

bigkoma
9th May 2009, 12:39
For me my method is working.


P.S. I programing in Linux, becouse ther I no have any problem's. But now I have a project who must work in Windows as client. :)

lucenty
16th May 2009, 17:03
i have the same problem with QIBASE !
Me too. Have you solved the problem?

lucenty
18th May 2009, 22:33
I've found then answer and I would share with other people that aren't able to make qt app load ibase drive. I hope I can help them.

1. At the beginning of the main.cpp (after creating QApplication instance) put the code line:


qApp->addLibraryPath(qApp->applicationDirPath() + "/plugins");

Then follows creating connection like this


QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE");
db.setHostName("localhost");
db.setDatabaseName(dbpath);
db.setUserName("SYSDBA");
db.setPassword("masterkey");
bool ok=db.open();

2. Create "plugins" folder and "sqldrivers" in the first one and put there the driver: qsqlibased4.dll
3. Put fbclient.dll to your app directory

Then final directory tree looks like this (for the debug build):
C:\Project\debug\project.exe
C:\Project\debug\fbclient.dll
C:\Project\debug\plugins\sqldrivers\qsqlibased4.dl l

I have a question: what difference is between qsqlibase4.dll and qsqlibased4.dll?

wysota
18th May 2009, 23:14
I have a question: what difference is between qsqlibase4.dll and qsqlibased4.dll?

The latter is a debug version of the plugin. It's required on Windows if your application is built in debug mode.

bigkoma
30th January 2011, 10:28
I have new problem :(

I have installed the newest QT version (2010.5). I compiled MySql (http://blog.rubypdf.com/2010/08/11/how-to-build-the-qmysql-plugin-under-windows-using-mingw/). I opened QtCreator , compiled my aplication and it worked, so I can be happy .... but I'm no happy beacourse this aplication don't work in another system ..... "Driver not loaded"
(I had copied all library)

Interesing is that this aplication not work ( the same error) when I change the Folder ("sqldriver") name in lokation : "C:\qt\2010.05\qt\plugins\".
So I thought that I must copy all file from this directory to my aplikation directory , then it should work ... but not.

Were is the problem ??

Lykurg
30th January 2011, 10:33
but I'm no happy beacourse this aplication don't work in another system ..... "Driver not loaded"
(I had copied all library)
Obviously you havn't or at the wrong place. So where have you copied them? Or have a look at qt.conf to define the place your application should look for the plugins.

wysota
30th January 2011, 10:34
Do you have MySQL client library (not the Qt plugin) installed on the other system?

bigkoma
30th January 2011, 10:38
Or have a look at qt.conf to define the place your application should look for the plugins.

Where do I have to look for this?


=====================================
edit
=====================================

Lykurg - thanks for information, :)

My "qt.conf" (in my application location) have simple look:


[Paths]
Plugins = ./plugins

So in location where I have my application, I created new folder "plugins" and copied the folder "sqldriver" from QT location to this folder.