How Qt loading SQL drivers?
-
wrote on 15 Jun 2012, 10:49 last edited by
Hi All! Have a trouble!
Work at MSVC2008, Qt 4.8.0, DB: PostgreSQL 8.4;
I'm compile driver for this db, copy it to the plugin folder at the Qt Dir. Then copy dirvers and dll-s (from bin folder postgre) to the Debug folder, which contains exe file of my application. When i execute a application from explorer (for example) - it's all right, all work correct, but when i try execute application for debuging (from Visual studio) - this app write at console:
@QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QPSQL7 QPSQL @
Why that? what i do wrong? I try copy drivers and dll-s to the app folder, try add this files to the PATH, and to the enviroment (at MSVC) - nothing of that are solve this issue.Thx 4 answers!
-
wrote on 15 Jun 2012, 12:57 last edited by
bq. Then copy dirvers and dll-s (from bin folder postgre) to the Debug folder, which contains exe file of my application.
I had have same problem in Windows. Make sure you put libs in currect place.
You should copy database dlls (qmysql4.dll, qpspsql4.dll, etc) in a path like this:
@<application-dir>/sqldrivers/@
And other libraries, e.g main Qt libraries (QtGui4.dll , etc.):
@<application-dir>/@ -
wrote on 15 Jun 2012, 13:38 last edited by
yep, i do exactly like you write! but when i try execute program by debugger - have a message: driver not loaded :(
-
wrote on 15 Jun 2012, 19:29 last edited by
did you compile debugging symbols for DBMS plugin?
-
wrote on 18 Jun 2012, 05:26 last edited by
yep, i compile 2 dlls and libs for release and for debug
-
wrote on 22 Jun 2012, 09:37 last edited by
Sorry, can't help you.
compile your plugins both debug and release,
add to .pro file,
@
qt += sql
@compile your Qt application with same compiler as you just compiled libraries,
put your plugin libraries in right place,
copy any other libraries provided by DBMS vendor beside your application.
This works properly for me.
1/6