Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issue in Connecting to Oracle Database Using Python with cx_oracle

krishnabharatApr 27 2020 — edited May 12 2020

I am using cx_oracle to connect the Oracle DB using python.I need your assistance in connecting DB. I'm using following code till date it worked well

Code-1:

import cx_Oracle as cx dsn_tns = cx.makedsn(HOST,PORT, service_name=SERVICE_NAME)

conn = cx.connect(user=USER, password=PW, dsn=dsn_tns)

Recently TCP port is disabled and we are using jdbc connection string to connect DB which has TCPS port number.can you help where I need to pass the protocol in above/ suggest any other method.

i tried following code

code-2:

dsn_tns='(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = tcps)(HOST =hostdetails)(PORT =port))) (CONNECT_DATA = (SERVICE_NAME = servicename)))' conn = cx.connect(user=USER, password=PW, dsn=dsn_tns) print(cx.version)

I got error: ORA-28759: failure to open file.

Any suggestion is appreciated. Thank you in advance.

Comments
Post Details
Added on Apr 27 2020
19 comments
4,357 views