PDA

View Full Version : SQL Driver not loaded in Release



^NyAw^
22nd September 2008, 10:07
Hi, I'm having a problem with a SQL driver.

The Sql connection is not done on Release but it connects on Debug.

The exe dir contains the Qt debug and release libs and I have the "sqldrivers" dir with the debug and release libs inside.

The connection returns me "Driver not Loaded".

Thanks,

spirit
22nd September 2008, 11:49
are you sure that yours application (release) don't use debug libs?
check dependency of application.

^NyAw^
22nd September 2008, 12:20
Hi,

The application dir contains the debug and release libs.
I checked with "Dependency Walker" and the dir contains the needed libs.

I have a computer that has the MySQL database and another computer that is the client. I have the application in the client computer. If I exec the application on the client, I get "Driver Not Loaded" error, but If I share the app dir and I exec the application from the server computer(using the shared dir), it works.

The server computer is the developer computer.

Thanks,

spirit
22nd September 2008, 12:27
do you use sql-plugins? if yes, then try to copy QTDIR/plugins/sqldrivers dir to yours app directory.

^NyAw^
22nd September 2008, 12:42
Hi,

I did it as I told you in the first post.

Thanks,

spirit
22nd September 2008, 12:47
so, you application dir has next structure


appdir
|----sqldrivers
| |---- qsqlmysql4.dll
| |-----qsqlmysql4d.dll
|----myapp.exe

right?

^NyAw^
22nd September 2008, 15:01
Hi,

Yes, in appdir also there are the Qt4 libs

jpn
22nd September 2008, 16:09
And the MySQL DLL is in PATH?

^NyAw^
22nd September 2008, 17:23
Hi,

Yes, the MySQL is in the Path. AI have also tryied to copy the MySQL release DLL into the appDir and the release app gets the same error and the debug app is connecting well.

Thanks,

^NyAw^
23rd September 2008, 11:05
Hi,

I have one question that I don't really understand.

The Envoirment variable "LIB" points to "%MYSQL%\lib\debug".

When Qt is compiled, the MySQL debug driver is linked on debug lib and MySQL release driver is linked on release lib?

So when I try to start the application and the Qt MySQL drivers are linked to the debug MySQL lib, the Qt driver don't find the correct MySQL lib.

Thanks,

spirit
23rd September 2008, 11:09
use path for LIB variable


LIB=%MYSQL%\lib\opt;

^NyAw^
23rd September 2008, 11:51
Hi,

Yes, it's what I was thinking.
So, the opt lib will be linked when compiling the app.

Thank you very much,

Another question to Visual Studio users: How can I force to link with different libs? As opt MySQL lib for release and debug MySQL lib for debug?

Thanks,

spirit
23rd September 2008, 12:00
try to add needed library manually.
e.g. go to "Project->%1 Properties" (%1 your project name), then go to "Linker->Input" and add in "Additional Dependecies" neede library.

^NyAw^
23rd September 2008, 12:03
Hi,

Fine.

Thank you very much again.
;)

josepvr
25th February 2009, 16:48
Thanks!
It worked for me!