Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Properly loading QOCI driver on macOS[Solved]
Forum Updated to NodeBB v4.3 + New Features

Properly loading QOCI driver on macOS[Solved]

Scheduled Pinned Locked Moved General and Desktop
9 Posts 2 Posters 2.1k 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.
  • ealioneE Offline
    ealioneE Offline
    ealione
    wrote on last edited by
    #1

    I managed to successfully build the qoci drivers needed by Qt to communicate with an Oracle db, When trying to connect though I get the Driver not loaded error. The same thing had happened to me with the Mysql drivers too, but I solved it using the install_name_tool command like such:

    @install_name_tool -change libmysqlclient.18.dylib /Users/administrator/Downloads/mysql-5.6.21-osx10.8-x86_64/lib/libmysqlclient_r.18.dylib libqsqlmysql.dylib@

    But for this case I am not sure how to solve the error, I tried copying all the libraries of instant client in all possible locations but still nothing.

    Has anyone else had this issue in the past, any idea on what should I do to solve it?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You should run your application QT_DEBUG_PLUGINS set to 1 to see where it fails

      [edit: corrected typo]

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • ealioneE Offline
        ealioneE Offline
        ealione
        wrote on last edited by
        #3

        Hey SGaist,

        Since QT_DEBUG_PLUGINGS is not all that well documented I randomly tried the command
        @set QT_DEBUG_PLUGINGS = 1@

        and since I saw nothing I went inside my app directory at Contents>MacOS where the executable is and tried

        @./DbConnect -QT_DEBUG_PLUGINS=1@

        What I noticed is that if I run my app from there it loads the plugin and then it freezes until it times out (presumably because my listener is not turned on). Please not that I had previously created a sqldrivers folder in this directory containing all the libraries of oracles' instant client.

        How come this happens?

        EDIT

        I just confirmed it, I can actually connect if I run the executable inside my app, but not if just double click that app, on the later case the driver won't load.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then you probably have a path issue with either the plugin or one of it's dependencies

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • ealioneE Offline
            ealioneE Offline
            ealione
            wrote on last edited by
            #5

            Most probably, do you know what the correct install_name_tool command would be for my case?

            EDIT

            ok i found about the existence of otool

            here is the output if I run it for the qosi driver

            @$ otool -L libqsqloci.dylib
            libqsqloci.dylib:
            libqsqloci.dylib (compatibility version 0.0.0, current version 0.0.0)
            /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1 (compatibility version 0.0.0, current version 0.0.0)
            /Users/administrator/Qt/5.3/clang_64/lib/QtSql.framework/Versions/5/QtSql (compatibility version 5.3.0, current version 5.3.1)
            /Users/administrator/Qt/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.1)
            /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
            /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)@

            It says that it needs libclntsh.dylib.11.1 at a directory that doesn't even exist

            so if I try to change it I can end up with this

            $ install_name_tool -change /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1 /Users/administrator/Downloads/QtTests/libs/libclntsh.dylib.11.1 libqsqloci.dylib
            $ otool -L libqsqloci.dylib
            libqsqloci.dylib:
            libqsqloci.dylib (compatibility version 0.0.0, current version 0.0.0)
            /Users/administrator/Downloads/QtTests/libs/libclntsh.dylib.11.1 (compatibility version 0.0.0, current version 0.0.0)
            /Users/administrator/Qt/5.3/clang_64/lib/QtSql.framework/Versions/5/QtSql (compatibility version 5.3.0, current version 5.3.1)
            /Users/administrator/Qt/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.1)
            /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
            /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)

            So now it is pointing at the right path, but yet it refuses to work.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              What does otool say about libclntsh ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • ealioneE Offline
                ealioneE Offline
                ealione
                wrote on last edited by
                #7

                Even though what I described above worked for MySql, it does not work for Oracle db, what you have to do, at least for me is to copy the instantclient libraries to /usr/lib. Moreover if you want to use sqlplus then copy all the content from the sql plus package from oracle at /usr/bin. I still don't know why install_name_tool didn't do the trick as I checked the dependencies.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Did you also check the dependencies themselves ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • ealioneE Offline
                    ealioneE Offline
                    ealione
                    wrote on last edited by
                    #9

                    Yes I followed all the links, but most probably you are right I must have missed something while changing the links for the libraries. Now what remains is building the db2 drivers and I finally succeed in managing to connect to all databases, a somewhat pointless task but I learned a few things along the way.

                    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