Reputation: 103
I'm trying to use QOCI
driver to connect to Oracle Database, but the driver is not available. For this simple code:
from PyQt5 import QtSql
QtSql.QSqlDatabase.isDriverAvailable('QOCI')
I get False
.
I tried checking the PATH
environmental settings, and I see that there is TNS_ADMIN
variable set to folder with driver file oci.dll
:
C:\Atena\instantclient_11_2
but it's still unavailable.
I tried downloading the driver from Oracle site, setting it up according to Oracle instructions (changing the PATH
variable to the new driver folder, copying TNSnames.ora file etc.), but still the driver is unavailable.
I want to have the driver available for PyQt5, load it, and the use it to connect to Oracle database.
Upvotes: 0
Views: 357
Reputation: 580
The OCI.DLL is included for example in instantclient-basic-windowsXXXXX.zip Assume you have unzipped file to
C:\ORACLE\IC\12201\instantclient_12_2
to make it available for other applications, set in user environment
ORACLE_HOME=C:\ORACLE\IC\12201\instantclient_12_2
PATH=%PATH%;%ORACLE_HOME%
with this setting any application using OCI.DLL should find it. Of course you have to install the right bitsize - i.e. if you application is 32bit, you need to install a 32bit Instant Client - if it is a 64bit App, you need 64bit instant client.
So - as far as I can see you need to build the QOCI manually. To do that, you need definetly the SDK package for instant client.
Sources on the web state that you need to include headers and libs from SDK - unfortunatly it looks like the QOCI still depends on Oracle Client 11.X - not instant client but regular client.
following libraries need to be used (last one is for client 12.x)
oci.lib ociw32.lib oraocci12.lib
on regular client
%ORACLE_HOME%\oci\lib\msvc
on instant client
%ORACLE_HOME%\sdk\lib\msvc
following headers need to be included
oci.h
on regular client
%ORACLE_HOME%\oci\include
on instant client
%ORACLE_HOME%\sdk\include
Unfortunatly there is no much support for MinGW so I cannot do that.
the "configure" command to prepare everything needs to include
-sql-oci -plugin-sql-oci
Upvotes: 1