PDA

View Full Version : Driver not loaded Driver not loaded



Hughen
26th February 2013, 07:17
I coding a program with Qt 4.8.4 and MySQL 5.5.(a non-install version mysql-5.5.29-win32)
I using mysql as my database driver. Now it able to work properly on my computer, but can not be run on other computers. It prompts "Driver not loaded Driver not loaded"
And I create a plugins file, including sqldrivers file(qsqlmysql4.dll) and codecs file(qcncodecs4.dll)
Well I copy the libgcc_s_dw2-1.dll, libmysql.dll, mingwm10.dll, QtCore4.dll, QtGui4.dll, QtSql4.dll to my program's file
Of course, my Qt supports "QSQLITE" "QMYSQL3" "QMYSQL" "QODBC3" "QODBC" drivers.

I need your help, please.

Lykurg
26th February 2013, 07:47
Hm, the error means normaly that libmysql.dll could not be found. So is libmysql.dll in the same directory as QtCore4.dll and also is libmysql.dll the library you used to build qsqlmysql4.dll?

lanz
26th February 2013, 07:47
Your qsqlmysql4.dll should be in 'Path_to_executable/sqldrivers/' folder for the program to run.
I had similar issue when putting it into 'Path_to_executable/plugins/sqldrivers/' folder.

Hughen
26th February 2013, 12:06
I added this code:


QString strLibPath(QDir::toNativeSeparators(QApplication:: applicationDirPath()) + QDir::separator() + "plugins");
app.addLibraryPath(strLibPath);

but there has the problem.
What should I do??

Hughen
26th February 2013, 14:24
Hm, the error means normaly that libmysql.dll could not be found. So is libmysql.dll in the same directory as QtCore4.dll and also is libmysql.dll the library you used to build qsqlmysql4.dll?
libmysql.dll is in MySQL's lib, and I copy to my program file.
libmysql.dll and qsqlmysql4.dll must copy to sqldrivers file??
And now libmysql.dll in the same directory as QtCore4.dll, but there also has the problem.
I don't know what you said.

Anenja
26th February 2013, 15:01
Hi for me on windows 7 it works like this:

Driver not loaded means the sqldrivers folder cannot be located -> if i rename my sqldrivers folder i will get this error...

my folder/path structur:

libmysql.dll
urProgramm.exe
otherQtDlls.dll
sqldrivers\qsqlmysql4.dll

sqldrivers is a folder in the "exe" directory.

That mean put the "libmysql.dll to ur exe and other qtdll´s like qtguidll.... put the sqldrivers Folder in the path where ur exe is located.


I hope this helps you out of this.

Greets Anenja

Hughen
26th February 2013, 15:24
Thanks.
just now I also use your advice to get access to load drivers, and it works well.
Thanks again.

Lykurg
26th February 2013, 15:26
Hyghen, where have you get that your programm supports "QSQLITE" "QMYSQL3" "QMYSQL" "QODBC3" "QODBC"? If it is on the "other" computer, then qsqlmysql4.dll is places correctly.

Have you tried to use Dependency Walker to see what library is actually missing?

Hughen
26th February 2013, 15:42
Of course, I get them by my computers(Qt 4.8.4+MySQL 5.5).
And all problems is solved, the qslqmysql4.dll is in sqldrivers file, the libmysql.dll must be in the program file.
In other words, libmysql.dll copy to root directory of main_program_run.exe
Thanks your help.
Nice to you.