-1

Hi I'm trying to connect Python jupyter to my Oracle sql developer. Please please someone tell me what I'm doing wrong.

  1. Install cx_Oracle pip install cx_Oracle Success!!!

  2. I went to Oracle Instant Client and downloaded Basic package instant client 21_3 version and unziped and saved in c drive

  3. Copy the Oracle instant client 21_3 path and pasted in environment variable

  4. Import cx_Oracle Conn=cx_Oracle(...details) Error is DPI-1047 Cannot locate a 64-bit Oracle Client library.

I honestly cannot tell what im doing wrong and all the tutorial videos are so confusing please please someone who already did this successfully please help me.

forpas
  • 160,666
  • 10
  • 38
  • 76
  • What does this have to do with SQLite? – forpas Mar 25 '22 at 18:01
  • The Windows cx_Oracle 'quickstart' instructions are useful: https://www.oracle.com/database/technologies/appdev/python/quickstartpythononprem.html Also see the cx_Oracle documentation on initialization https://cx-oracle.readthedocs.io/en/latest/user_guide/initialization.html#using-cx-oracle-init-oracle-client-to-set-the-oracle-client-directory – Christopher Jones Mar 25 '22 at 21:29

1 Answers1

0

You have to initialise cx_Oracle to tell it where the dependencies are. For example:

import cx_Oracle

CONFIG = {
    'user': 'hr',
    'password': 'oracle',
    'dsn': 'localhost/orcl'
}
cx_Oracle.init_oracle_client(lib_dir='<your path>/instantclient_19_8')

with cx_Oracle.connect(**CONFIG) as conn:

...and so forth

DarkKnight
  • 19,739
  • 3
  • 6
  • 22
  • Note that init_oracle_client() really only works on Windows and macOS. On platforms like Linux you have to set the system library search path e.g. LD_LIBRARY_PATH or use ldconfig _before_ you run python. – Christopher Jones Mar 25 '22 at 21:27