How Qt loading SQL drivers?



  • 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!



  • 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>/@



  • yep, i do exactly like you write! but when i try execute program by debugger - have a message: driver not loaded :(



  • did you compile debugging symbols for DBMS plugin?



  • yep, i compile 2 dlls and libs for release and for debug



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.