Skip to content
Advertisement

cx_Oracle connection fails with ‘DPI-1047: Cannot locate a 64-bit Oracle Client library’

Problem use connection oracle to python source, oracle now is worked to other language php (oci)

Error:

JavaScript

Code:

JavaScript

Advertisement

Answer

Update: try the latest version of cx_Oracle see the release announcement. This version (which was renamed python-oracledb) doesn’t need Instant Client so the installation is easier.

Here are the cx_Oracle Windows installation instructions, which you probably found from the error message you quoted.

I will assume (i) you actually have 64-bit Oracle client libraries 11g or later, and also (ii) have the required VS Redistributable as mentioned in the install instructions. Then a simple thing to try is to add this to the top of your script:

JavaScript

Use the actual path to your client libraries.

PHP may be 32-bit and using 32-bit Oracle libraries. If so, because you have a 64-bit Python, then you will need to install 64-bit Instant Client or install 32-bit Python. (Note PHP OCI8 doesn’t have an equivalent call to init_oracle_client(). In PHP you need to make sure the Oracle Client libraries are in the system search path e.g. PATH before the PHP process starts.)

Advertisement