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

                                I think the problem is, indeed, coming from the way PyQt4 is built with the binary, i rebuilt everything and got a new error message :

                                @The plugin 'C:/Python_x86/Lib/site-packages/PyQt4/plugins/sqldrivers/qsqloci4.dll' :
                                Plugin uses incompatible Qt library
                                expected build key "Windows msvc release full-config", got "Windows mingw release full-config"
                                not a plugin@

                                Now i'm trying to build PyQt' from the .zip archive using mingw but got the error
                                @Error: release\qtdetail.exe failed to create qtdetail.out. Make sure your Qt installation is correct.@

                                And a messagebox appears :
                                @The procedure's entry point _ZN11QTextStreamC1EP9QIODevice cannot be found in the dynamic link library QtCore4.dll@ (approximate translation from French, i don't know the exact error message in english)

                                EDIT : Solved the last error copying the QtCore4.dll in the Pyqt folder, i let you know what happens when i'm done building pyqt (it seems to take a while)

                                EDIT2 : I followed the tutorial on this site : http://www.oak-tree.us/blog/index.php/2009/05/12/pyqt-windows but now I got import errors, it seems python can't find the PyQt4 folder (which is in the Qt folder, as suggested in the tutorial) :
                                @from PyQt4 import QtCore, QtGui, QtSql
                                importError: No module named PyQt4@

                                Besides, the PyQt built doesn't look like the previous one I installed through the binary file, there's no plugins folder and it seems to lack dll (such as QtGui4.dll which can't be found in the PyQt4 directory)

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

                                  I finally managed to install the driver ! The problem came from the compiler as you suggested, the PyQt4 installer uses the Visual Studio compiler whereas Qt 4.8.5 uses mingw32 4.4...

                                  I rebuilt everything using mingw32 4.4 and it finally worked.

                                  To build the pyqt4 from the zip archive I used "this tutorial":http://www.oak-tree.us/blog/index.php/2009/05/12/pyqt-windows but i built it in C:\Python27\Lib\site-packages\PyQt4 instead of the Qt folder.

                                  I also had to remove 2 lines from the Makefile located at C:\Python27\Lib\site-packages\PyQt4
                                  @copy /y C:\Python27\Lib\site-packages\PyQt4_init_.py C:\Python27\Lib\site-packages\PyQt4_init_.py
                                  copy /y pyqtconfig.py C:\Python27\Lib\site-packages\PyQt4\pyqtconfig.py@

                                  Because I had this error :
                                  @File cannot be copied onto itself@

                                  Anyway, thanks a lot for your help SGaist

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

                                    You're welcome !

                                    Happy Coding ! :)

                                    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

                                    • Login

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