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. [Solved][PyQt] Install OCI driver
Forum Updated to NodeBB v4.3 + New Features

[Solved][PyQt] Install OCI driver

Scheduled Pinned Locked Moved Installation and Deployment
23 Posts 2 Posters 13.0k 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.
  • B Offline
    B Offline
    Balgun
    wrote on last edited by
    #1

    Hi,

    I hope I'm in the right section for my question, if not, I apologize.

    I'm trying to install the OCI driver on PyQt4 on windows and I can't find any helpful solution... All I found was how to install the OCI driver on Qt (here), but how can I make it work on pyqt ?
    I found the sqldriver folder but there is no oci folder nor oci.pro file.

    Does anyone have any advice to make it work please ?

    Thanks for your help,

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

      Hi and welcome to devnet,

      AFAIK, you need to get the Qt sources corresponding to the one you are using with PyQt4 and follow the instruction about building and installing. Once that's done you should be able to use it like any other database plugin

      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
      • B Offline
        B Offline
        Balgun
        wrote on last edited by
        #3

        Hi,

        I built the OCI driver on Qt4 ("this post":http://qt-project.org/forums/viewthread/6411/ helped a lot), i managed to make the release and debug dll but how can i make it work on PyQt ? When i try to open a database using QOCI, i still have the error message "Driver not loaded". I tried to copy the dll and the entire folder containing the dll in the PyQt4/plugins/sqldrivers folder but it isn't working either...

        Thanks for your answer,

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

          You also need to ensure that the folder that contains the OCI dlls are your PATH environment variable when running your program

          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
          • B Offline
            B Offline
            Balgun
            wrote on last edited by
            #5

            Both folders (Oracle and Qt4) containing the OCI dlls are in my PATH environment variable already.

            I also tried to change the QtGui.QApplication libraries (i added the path to the folder containing the OCI dll in the Qt4 folder) but still not working.

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

              [quote author="Balgun" date="1396958181"]
              I also tried to change the QtGui.QApplication libraries (i added the path to the folder containing the OCI dll in the Qt4 folder) but still not working.[/quote]

              What do you mean by that ?

              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
              • B Offline
                B Offline
                Balgun
                wrote on last edited by
                #7

                I thought that i had to link manually my application to the necessary library in qt, so I used QtGui.Qapplication.libraryPaths() to know which ones where used and then add (with QtGui.QApplication.addLibraryPath()) the path to the plugins in the Qt folder (C:\Qt\4.8.5\src\plugins) where the sqldrivers folder is. But that didn't help.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  Balgun
                  wrote on last edited by
                  #8

                  I'm trying to open the database with Qt Creator in C++ at the moment, at least to see if it's reachable, but I have a strange error, the QOCI driver is available but not loaded, i.e. when i list the drivers available with QSqlDatabase::drivers() i have the "QOCI" and "QOCI8" drivers, but when i call QSqlDatabase::addDatabase("QOCI"), i got the error message "Driver not loaded".

                  Do you know where it could come from ?

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

                    Check the PATH environment variable in the Run part of the Project panel. Verify that it does contain the path to the folder containing the OCI dlls

                    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
                    • B Offline
                      B Offline
                      Balgun
                      wrote on last edited by
                      #10

                      The PATH variable is ok, i also set the QT_DEBUG_PLUGINS variable to 1 in order to have a little more information, and i can see that the driver are found :

                      "QtFactoryLoader::QFactoryLoader() looking at "C:/Qt/4.8.5/plugins/sqldrivers/qsqlocid4.dll". keys ("QOCI8","QOCI")"

                      But apparently they're not loaded because i still have the "Driver not loaded" error when i try to create a database (even using QSQLITE or QODBC).

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

                        Am I reading correctly, you are not even able to create a database with QSQLITE ?

                        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
                        • B Offline
                          B Offline
                          Balgun
                          wrote on last edited by
                          #12

                          My bad, wasn't declaring my QSqlDatabase correctly...

                          I used :
                          @QSqlDatabase db = new QSqlDatabase();
                          db->addDatabase("QOCI")@

                          Instead of
                          @QSqlDatabase db = QSqlDatabase::addDatabase("QOCI")@

                          Now i'm back to my initial problem, which was using the OCI driver with pyqt4.

                          1 Reply Last reply
                          0
                          • B Offline
                            B Offline
                            Balgun
                            wrote on last edited by
                            #13

                            I have the following error when i copy the qsqloci4.dll to the Pyqt4/plugins/sqldrivers folder with the variable QT_DEBUG_PLUGINS set to 1 :

                            @QFactoryLoader::QFactoryLoader() looking at "C:/Python27/Lib/site-packages/PyQt4/plugins/sqldrivers/qsqloci4.dll"
                            The file 'C:/Python27/Lib/site-packages/PyQt4/plugins/sqldrivers/qsqloci4.dll' is not a valid Qt plugin.
                            not a plugin@

                            PyQt4 actually finds the dll but doesn't see it as a plugin... Maybe there is a specific way to build the oci driver for PyQt4 ?

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

                              Where are the the OCI dll(s) located ?

                              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
                              • B Offline
                                B Offline
                                Balgun
                                wrote on last edited by
                                #15

                                The original oci.dll from Oracle is located in C:/oracle/client/bin and the dll's I built for Qt4 qsqloci4, qsqlocid4.dll are in C:/Qt/4.8.5/plugins/sqldrivers.

                                If I add the library path of the Qt4 plugins I have the same error :
                                @app =QtGui.Qapplication(sys.argv)
                                QtGui.QApplication.addLibraryPath("C:/Qt/4.8.5/plugins/sqldrivers")@

                                Output :
                                @QFactoryLoader::QFactoryLoader() looking at "C:/Qt/4.8.5/plugins/sqldrivers/qsqloci4.dll"
                                The file 'C:/Qt/4.8.5/plugins/sqldrivers/qsqloci4.dll' is not a valid Qt plugin.
                                not a plugin@

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

                                  So is C:/oracle/client/bin in your PATH environment variable ? A plugin that can't load like that generally means it can't found its 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
                                  • B Offline
                                    B Offline
                                    Balgun
                                    wrote on last edited by
                                    #17

                                    Yes the PATH environment variable is set correctly with C:/oracle/client/bin and C:/Qt/4.8.5/plugins.

                                    1 Reply Last reply
                                    0
                                    • B Offline
                                      B Offline
                                      Balgun
                                      wrote on last edited by
                                      #18

                                      I ran Dependency Walker on the qsqloci4.dll file located in C:/Python27/Lib/site-packages/PyQt4/plugins/sqldrivers and I have the following output :

                                      @MSVCR90.DLL Error opening file. The system cannot find the file specified (2)
                                      IESHIMS.DLL Error opening file. The system cannot find the file specified (2)@ (I have the 2 same errors with qsqlite4.dll so i don't think these 2 are an issue)

                                      And 5 messages :

                                      @Error: At least one required implicit or forwarded dependency was not found.
                                      Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
                                      Error: modules with different CPU types were found.
                                      Warning: At least one delay-load dependency module was not found.
                                      Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.@

                                      It's my first time using Dependency Walker and i don't really know how to solve these (if it's the problem)

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

                                        There's something fishy here, are you sure you are using the same compiler as the one that was used to build PyQt4's Qt ?

                                        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
                                        • B Offline
                                          B Offline
                                          Balgun
                                          wrote on last edited by
                                          #20

                                          I used the PyQt4 binary which can be found at http://www.riverbankcomputing.co.uk/software/pyqt/download, i assumed it used the same compiler but how can I be sure of it ?

                                          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