0
votes

I am trying to establish a connection from a Jupyter Notebook using the following Python code:

!pip install cx_Oracle --upgrade
import cx_Oracle
dsn = cx_Oracle.makedsn("<myhost>", 1521, service_name="<myservice>")
connection = cx_Oracle.connect("<myuser>", "<mypassword>", dsn, encoding="UTF-8")

And get this error:

DatabaseError Traceback (most recent call last) in 1 dsn = cx_Oracle.makedsn("", 1521, service_name="") ----> 2 connection = cx_Oracle.connect("", "", dsn, encoding="UTF-8")

DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory". See https://oracle.github.io/odpi/doc/installation.html#linux for help

In the link, there is no information on how to install the library in Linux using Python from the Jupyter Notebook. How can I do such an installation?

1
Did you ever find a resolution to this? I expect that the file "kernel.json" needs to be modified to include the path to the libclntsh.so file. - OracleJavaNet
I stop trying at some point. Discarded the python approach and downloaded the data via Global Protect. - Jose Rondon

1 Answers

1
votes

I strongly expect you'll need to install the Oracle client libraries before starting Jupyter, because the OS library search path needs to contain the client library directory, and you can't set this inside a running process. The ODPI-C link does contain the steps you need to follow. You can install the latest Instant Client ZIP or RPM "Basic" package.

The cx_Oracle installation manual is here: https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html#installing-cx-oracle-on-linux