QT5.6 + OSX: QOCI driver not loaded but available



  • OSX: 10.11.4
    QT: 5.6
    Oracle: 11.2 64-bit

    Trying to create simple application with Oracle connection. libqsqloci is created successfully (thanks for manual), libqsqloci.dylib is locating in clang_64/plugins/sqldrivers

    .pro file:

    QT += core gui sql

    .cpp file:

    #include <QSqlDatabase>

    ...

    QSqlDatabase db = QSqlDatabase::addDatabase("QOCI");

    Application starts... and I see error:

    QSqlDatabase: QOCI driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QOCI QOCI8 QODBC QODBC3 QPSQL QPSQL7

    I not found anything working solution, so decide to ask here. Thank you


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Do you have the OCI libraries installed on your system ? More information about them here



  • @SGaist Thanks for reply. OCI libraries is installed, tnsnames is created, sqlplus is working successfully.

    My zshrc:
    export PATH=/usr/local/bin:$PATH
    export ORACLE_HOME=/Volumes/Data/Oracle/instantclient_11_2
    export LD_LIBRARY_PATH=$ORACLE_HOME
    export DYLD_LIBRARY_PATH=$ORACLE_HOME
    export TNS_ADMIN=$ORACLE_HOME/network/admin
    export OCI_HOME=$ORACLE_HOME
    export OCI_INCLUDE_DIR=$ORACLE_HOME/sdk/include
    export OCI_VERSION=11
    export NLS_LANG=AMERICAN_AMERICA.CL8MSWIN1251
    export PATH=$ORACLE_HOME:$PATH
    export CLASSPATH=$ORACLE_HOME:$PATH

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME:/Volumes/Data/Qt5.6.0/5.6/clang_64/plugins/sqldrivers/


  • Lifetime Qt Champion

    Then you should run otool -L on the Qt OCI plugin to see if it is missing something.

    By the way, there's no need to put Qt's plugins folder in the LD_LIBRARY_PATH.


Log in to reply
 

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