oracle / python-cx_Oracle

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

cx_Oracle.DatabaseError: Error while trying to retrieve text for error ORA-01804 #632

Closed amiroh81 closed 2 years ago

amiroh81 commented 2 years ago
  1. What versions are you using?
platform.platform: Linux-4.18.0-305.el8.x86_64-x86_64-with-glibc2.28 sys.maxsize > 2**32: True platform.python_version: 3.9.7 cx_Oracle.version: 8.3.0 cx_Oracle.clientversion() > i got the error below 2. Describe the problem when i try to run commnd i got the error: **DatabaseError: Error while trying to retrieve text for error ORA-01804**
  1. Include a runnable Python script that shows the problem.
cx_Oracle.clientversion()
cjbj commented 2 years ago

I'm guessing you also asked this at https://stackoverflow.com/questions/72899081/db-connect-failure-python-cx-oracle-ora-01804

Regardless if you did or did not, Please update the question with the background info. Show us the environment variables that are actually set in the shell (not that you think are set in any configuration file). Explain what was installed and where. Try not copy libraries around randomly.

amiroh81 commented 2 years ago

Hi

Thanks for your response Hope this is what you ask for :

Anconda install in /home/anaconda3 Orcale client install in /OracleTools/19.0.0 I am using python 3.9.7 cx oracle 8.3.0

CONDA_SHLVL=1 LD_LIBRARY_PATH=/OracleTools/19.0.0/lib/ CONDA_EXE=/home/anaconda3/bin/conda LANG=en_US.UTF-8 HISTCONTROL=ignoredups HOSTNAME=vrl-anaconda1 CONDA_PREFIX=/home/anaconda3 SUDO_COMMAND=/bin/bash _CE_M= USER=root PWD=/root SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass HOME=/root CONDA_PYTHON_EXE=/home/anaconda3/bin/python XDG_DATA_DIRS=/root/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share _CE_CONDA= CONDA_PROMPT_MODIFIER=(base) SUDO_UID=78740 MAIL=/var/spool/mail/root SHELL=/bin/bash TERM=vt100 LD_RUN_PATH=/OracleTools/19.0.0/lib/ SHLVL=1 LOGNAME=root PATH=/home/anaconda3/bin:/home/anaconda3/condabin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin CONDA_DEFAULTENV=base HISTSIZE=1000 LESSOPEN=||/usr/bin/lesspipe.sh %s =/bin/env

cjbj commented 2 years ago

If you have what we call a 'full' client, then I believe you would need to set ORACLE_HOME to /OracleTools/19.0.0/ so that data files can be found. What is in that directory? Why is LD_RUN_PATH set? What OS are you using? What's the exact script you are running - and are you running it from the command line or are you using something like flatpak to package it?

Have you tried the latest release, now known as python-oracledb?

amiroh81 commented 2 years ago

Hi this is the bash profile : export ORACLE_BASE=/OracleTools/ export ORACLE_HOME=/OracleTools/19.0.0 export SHLIB_PATH=$ORACLE_HOME/lib export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin:$ORACLE_HOME/OPatch export NLS_LANG=AMERICAN_AMERICA.IW8ISO8859P8 NLS_LANGUAGE=AMERICAN ORA_NLS=/OracleTools/19.0.0/nls/data

as you can see the ORACLE_HOME set correctly. on /OracleTools/19.0.0 directory have all the oracle client's files platform.platform: Linux-4.18.0-305.el8.x86_64-x86_64-with-glibc2.28

the script is very simple import cx_Oracle cx_Oracle.init_oracle_client()

In the last few hours, I have been able to move forward in solving the problem. When I try at Command Line connect to Python I can connect with CX_Oracle. When I connect with Pycharm working properly. Only when I connect with Jupyter Notebook I experience the problem. Importantly, all Anaconda installations and the python package were installed at SUDO level Can all this information direct we to the source of the problem? Thanks

cjbj commented 2 years ago

What you set in the bash profile isn't what you showed was actually set in the shell. As you found, it seems some environments have different environment variables enabled. You'll need to make sure Jupyter is run in a shell that has the environment set correctly.

If you have full control over your machine, and you only have the Oracle client for Python, then you would find it easier to install the Instant Client Basic RPM, since this sets the environment for you. However if you install the RPM, then it will cause conflicts with your current client libraries.

Depending on your needs, try python-oracledb since it doesn't necessarily need client libraries so all the above is moot.

amiroh81 commented 2 years ago

Hi so the problem was my env setting. i set it all again and the problem solve thanks