QSqlDatabase: QOCI driver not loaded QSqlDatabase: available drivers: QSQLITE QPSQL7 QPSQL



  • Hello Everyone,
    as you can see, I have problem with loading libqsqloci.so.

    I compiled this library in Debian 3.9.8-1 x86_64 GNU/Linux with success.
    Now I have this library, but it doesn't work.

    All dependencies present in system, like you can see bellow
    ldd /usr/lib/x86_64-linux-gnu/qt4/plugins/sqldrivers/libqsqloci.so
    linux-vdso.so.1 (0x00007fff5d7fe000)
    libclntsh.so.11.1 => /lib/x86_64-linux-gnu/libclntsh.so.11.1 (0x00007fb3173ae000)
    libQt5Sql.so.5 => /home/roma/qt/qtbase/lib/libQt5Sql.so.5 (0x00007fb317171000)
    libQt5Core.so.5 => /home/roma/qt/qtbase/lib/libQt5Core.so.5 (0x00007fb316a7e000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb316862000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fb31655f000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb316260000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb31604a000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb315c9e000)
    libnnz11.so => /home/oracle/u00/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.so (0x00007fb3158d5000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb3156d1000)
    libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fb3154b9000)
    libaio.so.1 => /lib/x86_64-linux-gnu/libaio.so.1 (0x00007fb3152b6000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fb3150ae000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fb319c11000)

    But during debuging my project, I see error message like this
    QSqlDatabase: QOCI driver not loaded
    QSqlDatabase: available drivers: QSQLITE QPSQL7 QPSQL
    DB not open

    But this library defined in
    /usr/lib/x86_64-linux-gnu/qt4/plugins/sqldrivers/
    libqsqlite2.so libqsqlite.so libqsqlmysql.so libqsqloci.so libqsqlodbc.so libqsqlpsql.so libqsqltds.so

    II added in main.cpp this string @qDebug() << app->libraryPaths();@
    for checking enviroment and after compiling this project I saw next:
    ("/usr/lib/x86_64-linux-gnu/qt4/plugins", "/home/roma/Project/build-Astelit_1-Qt_4_8_4_in_PATH_System-Debug")

    In both directories this library is present:
    /home/roma/Project/build-Astelit_1-Qt_4_8_4_in_PATH_System-Debug/libqsqloci.so
    /usr/lib/x86_64-linux-gnu/qt4/plugins/sqldrivers/libqsqloci.so

    Code where I using connection to DB looks like
    @bool MainWindow::createConnection() {
    QSqlDatabase db = QSqlDatabase::addDatabase("QOCI");
    db.setDatabaseName("myDB");
    db.setUserName("roma");
    db.setHostName("localhost");
    db.setPassword("roma");

    if(!db.open()){
        qDebug() << "DB not open";
        return false;
    }
    return true;
    

    }@

    I know, that were several topics with the same title, but I haven't found answer for last several day.
    If somebody need an additional information, i will present it.
    Thank for you help.



  • The Oracle run time library is probably not in the run time library path of the program.



  • Thank for fast responce, ChrisW67,

    bq. The Oracle run time library is probably not in the run time library path of the program.

    If you talk about that $LD_LIBRARY_PATH, I already have had it:
    echo $LD_LIBRARY_PATH
    /home/oracle/u00/app/oracle/product/11.2.0/dbhome_1/lib/

    But problem still exist.
    Waiting for your responce.
    Thank a lot



  • I have found the solution.
    My QtCreator worked with using Qt 4.8.4 and I compiled library with Qt 5.1.1.
    So I added new library to QTCreator and now I have new problem.
    But previous problem was solved.

    Thank a lot everybody


Log in to reply
 

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