Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Oracle driver does not work (Solved)
Forum Updated to NodeBB v4.3 + New Features

Oracle driver does not work (Solved)

Scheduled Pinned Locked Moved Installation and Deployment
11 Posts 2 Posters 6.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fronald
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      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.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fronald
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

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

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fronald
            wrote on last edited by
            #5

            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!

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fronald
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • F Offline
                F Offline
                fronald
                wrote on last edited by
                #7

                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!

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

                  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?

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    fronald
                    wrote on last edited by
                    #9

                    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!

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on last edited by
                      #10

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

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      1 Reply Last reply
                      0
                      • F Offline
                        F Offline
                        fronald
                        wrote on last edited by
                        #11

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

                        Thanks for the Good luck. HAHAHAHA

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved