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
The connection parameter should be as follows
connection = cx_Oracle.connect("username/password@host/service_name e.g orcl")
to get the listener/service_name type the following in the oracle sqlplus
SQL> show parameter local_listener
literal under VALUE is your listener/service_name.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…