Oracle driver does not work (Solved)



  • Hi guys,

    I have a Qt desktop application with oracle driver (qsqloci). But my app give follow error:

    "The file '/Users/fronald/opt/QtSDK/QtSources/4.7.4/src/plugins/sqldrivers/oci/libqsqloci_debug.dylib' is not a valid Qt plugin."

    My build profile is DEBUG, and the oracle instant client libraries are in DYLD_LIBRARY_PATH. The libqsqloci has been compiled without problems.

    I'm using the follow code to load the oci plugin:

    @QPluginLoader loader(libPath);
    loader.load();
    QObject *plugin = loader.instance();

    if (!plugin){
        qDebug() << "ERROR: Oracle plugin not loaded.";
        qDebug() << loader.errorString();
        return FALSE;
    }else{
        QSqlDriverPlugin *sqlPlugin  = qobject_cast<QSqlDriverPlugin *>(plugin);
    
        if (!sqlPlugin ) {
            return FALSE;
        }else{
            qDebug() << "INFO: Oracle plugin loaded.";
            this->db = QSqlDatabase::addDatabase(sqlPlugin->create("QOCI"),this->conn_name);
    
            db.setHostName(server);
            db.setDatabaseName(sid);
            db.setUserName(username);
            db.setPassword(password);
            db.open();
            return db.isOpen();
        }
    }@
    

    The libPath var contains the dylib location.

    This same code works fine on Windows, but on MacOSX nothing.

    Any ideas?



  • The architectures in the universal binaries must match. The instant client is usually only i386 (Intel 32 bit) or x86_64 (Intel 64 bit), but not both as the usual executables. You should make your application project to only build with the architecture you have your instant client with:

    @
    QT += x86_64
    QT -= i386 ppc ppc_64
    @

    Swap i386 and x86_64 if you have 32 bit instant client.



  • Hi Volker,

    Thank you for your reply. <MYPROJECT>.pro:

    @
    QT += core gui sql

    QT += x86_64
    QT -= i386 ppc ppc_64

    TARGET = MastersafInteg
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp
    preferences.cpp
    appconfig.cpp
    dbconnection.cpp

    HEADERS += mainwindow.h
    preferences.h
    appconfig.h
    dbconnection.h

    FORMS += mainwindow.ui
    preferences.ui

    RESOURCES +=
    icons/icons.qrc
    @

    Now, the oci.pro:

    @
    TARGET = qsqloci

    SOURCES = main.cpp
    include(../../../sql/drivers/oci/qsql_oci.pri)

    include(../qsqldriverbase.pri)

    QT += x86_64
    QT -= i386 ppc ppc_64

    LIBS += -L/Volumes/HITACHI/Programas/instantclient_10_2
    INCLUDEPATH += /Volumes/HITACHI/Programas/instantclient_10_2/sdk/include
    @

    But at qmake run, the follow error is show:

    Project MESSAGE: Warning: unknown QT: x86_64
    Project MESSAGE: Warning: unknown QT: x86_64
    Project MESSAGE: Warning: unknown QT: x86_64

    After, the build is successful and i get the same error. (...is not a valid Qt plugin)

    Any idea?

    Thanks!



  • Ah, sorry, actually it is the CONFIG variable, not QT. It's a bit too late in the night, as it seems :)



  • Wow! Progress! But still not success.

    INFO: Oracle plugin in location "/Users/fronald/opt/QtSDK/QtSources/4.7.4/src/plugins/sqldrivers/oci/libqsqloci_debug.dylib"
    INFO: Oracle plugin loaded.
    Segmentation fault: 11

    My debug message "INFO: Oracle plugin loaded." is before the code line:

    @
    this->db = QSqlDatabase::addDatabase(sqlPlugin->create("QOCI"),this->conn_name);
    @

    Here, my application launch a Segmentation Fault signal.

    Any ideas?

    But thank you! The CONFIG variable have success!



  • At debug view, the error message is:

    *Signal name : *
    EXC_BAD_ACCESS
    *Signal meaning : *
    Could not access memory

    I'm try'in here. If any idea, please help me.

    If i succeed, will put the solution here.



  • Volker,

    Thanks for your help. The my problem with plugin is solved. Now i have a problem with instant client 64bits. That issue has described here https://forums.oracle.com/forums/thread.jspa?threadID=2256568.

    Thanks!



  • I need to lookup my Oracle account to read the forum entry. But from your post, I would say the problem is solved for the Qt part, the crash is now due to some Oracle instant client issue?



  • Absolutely right.

    The libclntsh.so is crashed on 64bits. On the Oracle forum, they say for use the 32bits version of oracle client. The 64bits on Lion does not open sqlplus.

    Oh... Oracle...

    The Oracle have a own world.

    Thanks man!



  • [quote author="fronald" date="1326671930"]Absolutely right.

    The libclntsh.so is crashed on 64bits. On the Oracle forum, they say for use the 32bits version of oracle client. The 64bits on Lion does not open sqlplus.

    Oh... Oracle...

    The Oracle have a own world.

    Thanks man![/quote]

    Oh yes, what a true word :-)
    I managed to avoid 64 bit oracle on the Mac up to now. And reading this, I won't change that any soon :-)

    Good luck!



  • Only works on Snow Leopard. On Lion... Nothing.

    Thanks for the Good luck. HAHAHAHA


Log in to reply
 

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