How to fix: cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library – Python

After some more research i got the solution from Ubuntu community , after you have installed oracle instant-client you will have to integrate oracle libraries as follows: export LD_LIBRARY_PATH=/usr/lib/oracle/<version>/client(64)/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} An example for 12.1 version for Linux x86_64 can be: export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} where <version> indicates the version of your of your oracle instant-client e.g 11.2, 12.2 … Read more

How can I access Oracle from Python?

Here’s what worked for me. My Python and Oracle versions are slightly different from yours, but the same approach should apply. Just make sure the cx_Oracle binary installer version matches your Oracle client and Python versions. My versions: Python 2.7 Oracle Instant Client 11G R2 cx_Oracle 5.0.4 (Unicode, Python 2.7, Oracle 11G) Windows XP SP3 … Read more

cx_Oracle doesn’t connect when using SID instead of service name on connection string

I a similar scenario, I was able to connect to the database by using cx_Oracle.makedsn() to create a dsn string with a given SID (instead of the service name): dsnStr = cx_Oracle.makedsn(“oracle.sub.example.com”, “1521”, “ora1″) This returns something like (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle.sub.example.com)(PORT=1521)))(CONNECT_DATA=(SID=ora1))) which can then be used with cx_Oracle.connect() to connect to the database: con = cx_Oracle.connect(user=”myuser”, password=”mypass”, … Read more

cx_Oracle: How do I iterate over a result set?

The canonical way is to use the built-in cursor iterator. curs.execute(‘select * from people’) for row in curs: print row You can use fetchall() to get all rows at once. for row in curs.fetchall(): print row It can be convenient to use this to create a Python list containing the values returned: curs.execute(‘select first_name from … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)