[Solved][PyQt] Install OCI driver
-
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,
-
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
-
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,
-
You also need to ensure that the folder that contains the OCI dlls are your PATH environment variable when running your program
-
-
[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 ?
-
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.
-
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 ?
-
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
-
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).
-
Am I reading correctly, you are not even able to create a database with QSQLITE ?
-
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.
-
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 ?
-
Where are the the OCI dll(s) located ?
-
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@ -
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
-
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)
-
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 ?
-
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 ?