superset: Can't connect to Oracle DB
I’m having an issue to connect to an Oracle DB. I’ve already followed the steps to create a requirements-local.txt file into docker/ cx_Oracle package, but still not working.
How to reproduce the bug
touch ./docker/requirements-local.txtecho "cx_Oracle" >> ./docker/requirements-local.txtdocker-compose build --force-rmdocker-compose up
Expected results
I was expecting to be able to connect into a Oracle database.
Actual results
Actually I got this error message:
ERROR: (builtins.NoneType) None (Background on this error at: http://sqlalche.me/e/13/dbapi)
Screenshots

Environment
(please complete the following information):
- browser type and version: Brave
- superset version:
latest - any feature flags active:
cx_Oracledriver - Database: AWS Oracle
Checklist
Make sure to follow these steps before submitting your issue - thank you!
- I have checked the superset logs for python stacktraces and included it here as text if there are any.
- I have reproduced the issue with at least the latest released version of superset.
- I have checked the issue tracker for the same issue and I haven’t found one similar.
Additional context
I’m using an AWS Oracle instance to test.
I’ve checked the logs of the superset_worker superset_worker_beat containers, and seems that the cx-Oracle lib was successfully installed.

The superset_app container log:

I’m using the following string connection:
oracle://<username>:<password>@<hostname>:<port>
from https://superset.apache.org/docs/databases/oracle/
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 35 (2 by maintainers)
Found a solution to above problem, used docker image apache/superset to build another custom container and that resolved this issue. PSB Dockerfile which is working fine.
FROM apache/superset USER root RUN pip install cx_Oracle RUN apt update RUN apt -y install alien libaio1 wget RUN wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-basiclite-18.5.0.0.0-3.x86_64.rpm RUN alien -i oracle-instantclient18.5-basiclite-18.5.0.0.0-3.x86_64.rpm RUN sh -c ‘echo /usr/lib/oracle/18.5/client64/lib/ > /etc/ld.so.conf.d/oracle.conf’ RUN ldconfig USER superset
@sachin-bureau nice work. Earlier I also appended the steps on my blog https://cjones-oracle.medium.com/steps-to-use-apache-superset-and-oracle-database-ae0858b4f134 so the info is in one place.
i had the same issue connecting a docker based superset to a oracle database.
with this very good step by step tutorial i installed a superset instance by scratch and with the following steps (after the installation) my connection to oracle db worked:
the connection string in superset was:
oracle+cx_oracle://USRER:PASSWORD@HOST:PORT/SERVICE_NAME
thank you very much to @shantanukhond for the tutorial and @antiwari001 for the solution to the oracle problem!!
I’m working through a similar problem now. Did you install the Oracle instant client into the Docker container or system you are running superset from? cx_oracle requires either the instant client or full Oracle client. The recently released
python-oracledbno longer has this requirement, so installation should get easier in the near future.I’m using the following in my Docker container to install the latest SQL client:
For those using the Docker Compose setup and wanting to switch to the new
oracledbinstead ofcx_Oraclewith Instant Client, here are the steps:requirements_local.txtin thedockerfolder.oracledbto this file to download the latestpython-oracledb.docker/pythonpath_dev/superset_config.py.docker-compose up -dto start the setup.If your connection uses a service name, convert the connection string. For example, change:
oracle://user:password@192.168.1.201:1521/myservicenametooracle://user:password@192.168.1.201:1521/?service_name=myservicename.With thanks to the write up of @cjbj.
Following this i also sucessfully connected to my oracledb. I did have to use the long connection string from @cofin and manually install the gevent python library
pip install cx_Oracle mkdir -p /opt/oracle cd /opt/oracle wget https://download.oracle.com/otn_software/linux/instantclient/1920000/instantclient-basic-linux.x64-19.20.0.0.0dbru.zip unzip instantclient-basic-linux.x64-19.20.0.0.0dbru.zip apt-get install -y --no-install-recommends libaio1 sh -c “echo /opt/oracle/instantclient_19_20 > /etc/ld.so.conf.d/oracle-instantclient.conf” ldconfig
Running These commands worked for me
hello everyone ,
i got this error ERROR: (builtins.NoneType) None [SQL: (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”. See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help (Background on this error at: https://sqlalche.me/e/14/4xp6)] (Background on this error at: https://sqlalche.me/e/14/dbapi)
please can you help it anyone.
One additional note, in case it helps.
I had to connect using a TNS formatted string instead of the easy connect format:
oracle+cx_oracle://username:password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host_or_scan_address)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=db_service_name)))EDIT: Updated connect string to reference the Oracle driver correctly.