oracle / python-cx_Oracle

Python interface to Oracle Database now superseded by python-oracledb
https://oracle.github.io/python-cx_Oracle
Other
888 stars 361 forks source link

DPI-1047: 32-bit Oracle Client library cannot be loaded-Error #102

Closed noldini closed 6 years ago

noldini commented 7 years ago

Hello, I'm completly new in Python and new in connection python with Oracle, espacially wenn its a remote acces to a database server of my university. Could you please help me and say what to do?

I get 2 errors,.

Answer the following questions:

  1. What is your version of Python? Is it 32-bit or 64-bit? Python 2.7.14 (32 bit)

  2. What is your version of cx_Oracle? 6.0.2

  3. What is your version of the Oracle client (e.g. Instant Client)? How was it installed? Where is it installed?

instantclient_12_2 12.2.0.1.0 32 bit Its in C:\instantclient_12_2 But not installed, there is no install file inside

  1. What is your version of the Oracle Database? ?? Its a Remote Access to the Database of my university

  2. What is your OS and version? Windows 10 Pro 64-bit

  3. What compiler version did you use? For example, with GCC, run gcc --version.

n/a

  1. What environment variables did you set? How exactly did you set them? c:\Python27 c:\instantclient_12_2 (for the OCI.dll file)

  2. What exact command caused the problem (e.g. what command did you try to install with)? Who were you logged in as?

I get 2 different errors. If I run: 1) import cx_Oracle connstr = '/@**:1521/orcl' conn = cx_Oracle.connect(connstr)

I get (see 1) in point 9)

If I run 2) import cx_Oracle ip = '######.de' port = 1521 SID = 'orcl' dsn_tns = cx_Oracle.makedsn(ip, port, SID) db = cx_Oracle.connect('**', '**', dsn_tns)

I get (see 2) in point 9)

9. What error(s) you are seeing?

1) cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

2) cx_Oracle.DatabaseError: DPI-1047: 32-bit Oracle Client library cannot be loaded: "Das angegebene Modul wurde nicht gefunden". See https://oracle.github.io/odpi/doc/installation.html#windows for help

anthony-tuininga commented 7 years ago

Something seems a bit off! Your first error implies that the OCI dll was able to be loaded and used, even if you couldn't connect to the database. Your second error indicates that you couldn't even load the OCI dll at all! That suggests some changes were made to your configuration in between. Can you double check your PATH environment variable and make sure that a 32-bit OCI.dll can be found in it?

noldini commented 6 years ago

Can be closed, thanks!

anthony-tuininga commented 6 years ago

Ok. Can you enlighten us on what you changed to correct the issue? Others following along may appreciate it! Thanks.

noldini commented 6 years ago

Yes offcourse. I just had to install the 32-bit version. I had the 64bit version installed, I was wrong. Thank you!

nas12321 commented 6 years ago

Hi Noldini

I am facing same issue and not able to resolve. Configuration -- python 3.6 (32 bit version), oracle database 11.2 (32 bit) with orasqlplusic11.dll file in instantclient folder, cx_Orcale version 6.2.1 (as per internet, it is compatible with 32 bit oracle database) System OS - window 7 professional 64 bit version Error -----DPI-1047: 32-bit Oracle Client library cannot be loaded

I guess I have issue with Instant Client. Any help wuld be appreciated. Please help!!!

cnolden90 commented 6 years ago

For me the solution that not everything was in the same version. I think you should check that everything is 32-bit. You are using the 32bits pythin version, so you should also use a 32bits Oracle Instant client. You’re 32bits Python try to find 32bits oracle libraries and can’t find them maybe...

nas12321 commented 6 years ago

Thanks cnolden90

Exact error is:

cx_Oracle.DatabaseError: DPI-1047: 32-bit Oracle Client library cannot be loaded: "D:\app\Administrator\product\11.2.0\dbhome_1\bin\oci.dll is not the correct architecture". See https://oracle.github.io/odpi/doc/installation.html#windows

When I visited the github link as mentioned in above error comment, it suggest setting environment variable for instant client. I took couple of files - oci.dll, orannzsbb11.dll, oraocci11.dll,orasqlplusic11.dll and sqlplus.exe file and placed them in a folder called . I placed this folder at - D:\instantclient11_1 as my oracle sql is in D drive.

I set the environment variable to D:\instantclient11_1.

Still it is not working. Any Help!

nas12321 commented 6 years ago

Also, after installing cx_oracle, I observed that there is a file - cx_Oracle.cp36-win32

Does it mean that my cx_Oracle file is suitable for Wiondow 32 bit and not for Window 64 bit ( version I am currently using)

anthony-tuininga commented 6 years ago

From the error D:\app\Administrator\product\11.2.0\dbhome_1\bin\oci.dll is not the correct architecture. It is 64-bit but you are running 32-bit Python. Either run 64-bit Python or use a 32-bit instant client. If you already have a 32-bit instant client make sure it is earlier in the PATH environment variable than the full installation that it cannot load. Hope that helps!

lakshmi1212 commented 4 years ago

Hi nandini, I am getting the same error that u all faced earlier DPI-1047: Cannot locate a 32-bit Oracle Client library: "The specified module could not be found". i installed Instant Client Package - Basic 32 bit and copied it to c:/omlclient/instantclient_12.1 installed Instant Client Package - SDK and set the Environment var, PATH in System Variables and , but still when i run dir in command prompt , i could not see OCI.DLL and also when i run the pycharm prgm , got the above error.

can any one help , thanks in advance

anthony-tuininga commented 4 years ago

Please don't comment on a closed issue. Create a new one and link to this one instead. Thanks!

You can use cx_Oracle 8 and set the environment variable DPI_DEBUG_LEVEL to the value 64 before running your code. That should provide additional information on what is being tried and what is failing.