0

I encounter DatabaseError: Error while trying to retrieve text for error ORA-01804 when I try to connect python to oracle. I have downloaded instant client 19.3.0.0.0

I am using MacBook(10.15.3). Here is my code:

! pip install cx_Oracle

import io
import base64
from urllib.request import urlopen

import os
os.chdir("/Users/aa/Option/Oracle/instantclient_19_3-2") # use the path we copied from step 5
import cx_Oracle

dsn_tns = cx_Oracle.makedsn("aaa", "bbb", service_name="ccc")
conn = cx_Oracle.connect(user= "ddd", password="222", dsn=dsn_tns)
c = conn.cursor()

it returns:

Requirement already satisfied: cx_Oracle in /Users/aa/opt/anaconda3/lib/python3.7/site-packages (7.3.0)
---------------------------------------------------------------------------
DatabaseError                             Traceback (most recent call last)
<ipython-input-17-d2cb8e0df445> in <module>
     10 
     11 dsn_tns = cx_Oracle.makedsn("aaa", "bbb", service_name="ccc")
---> 12 conn = cx_Oracle.connect(user= "ddd", password="222", dsn=dsn_tns)
     13 c = conn.cursor()

DatabaseError: Error while trying to retrieve text for error ORA-01804

How can I solve it? Thank you very much.

1

1 Answer 1

1

Make sure that your ORACLE_HOME and LD_LIBRARY_PATH environment variables are correctly set (or unset) before you run your script.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.