0

I am trying to deploy my Python code where it involves usage of Oracle connection using cx_oracle module. I referred the below link to set up my LD_LIBRARY_PATH

Deploy instant oracle on Pivotal CloudFoundry for cx_Oracle

export LD_LIBRARY_PATH=C:/Users/pm/Documents/project_1/oracle/instantclient_19_9:${LD_LIBRARY_PATH:-}
export OCI_LIB_DIR=C:/Users/pm/Documents/project_1/oracle/instantclient_19_9
export OCI_INC_DIR=C:/Users/pm/Documents/project_1/oracle/instantclient_19_9/sdk/include

Still facing same issue once code is pushed on to PCF.

[ERR] cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory".

I have downloaded the oracle client zip file for windows 64bits 19.9 version. And unzipped into the folder in my desktop path where my application is stored and used to push the code to pcf(C:/Users/pm/Documents/project_1/).

Could someone please guide me if any of the steps need modification and help me fix the issue.

Syscall
  • 19,327
  • 10
  • 37
  • 52
  • 1
    If you are trying to `cf push` a Python application, it's not going to run on Windows. It will run on a Linux container, so you'd need to download the 64-bit Linux version of the Oracle client and put that into your app's directory. Also, your exports need to be prefixed with `/home/vcap/app/` as that's the path to your app in a Linux container followed by the folder where you extracted the Linux client. If you extract the Oracle Linux client to a folder called `oracle` under your app root, everything should match exactly to the other SO post. – Daniel Mikusa Mar 25 '21 at 13:11
  • The error message mentions "libclntsh.so" which indicates you are actually running on Linux, so make sure you install a Linux Instant Client. Why does your LD_LIBRARY_PATH contain a Windows-like name "C:" if you are on Linux? Also, OCI_LIB_DIR and OCI_INC_DIR are not used by cx_Oracle. – Christopher Jones Mar 26 '21 at 05:31
  • Thank you so much for the details, which helped me fix the issue. I downloaded a linux version and placed the folder inside my buildpack. Also edited my .profile file to the add the application path mounted in linux server i.e, /home/vcap/app. – monica p May 03 '21 at 07:03
  • Now my .profile is as following and my code works perfect :) LD_LIBRARY_PATH=/home/vcap/app/instantclient_21_1:${LD_LIBRARY_PATH:-} export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/vcap/app/instantclient_21_1 export OCI_LIB_DIR=/home/vcap/app/instantclient_21_1 export OCI_INC_DIR=/home/vcap/app/instantclient_21_1/sdk/include – monica p May 03 '21 at 07:06

1 Answers1

0

On Windows the environment variable you want to manipulate is PATH. If that doesn't help, you can also use the environment variable DPI_DEBUG_LEVEL and set that to the value 64. That will show you all of the paths that are being tried.

You can see all of this in the installation manual.

Anthony Tuininga
  • 6,388
  • 2
  • 14
  • 23