python-cx_Oracle icon indicating copy to clipboard operation
python-cx_Oracle copied to clipboard

ezconnect protocol as argument while connecting to the database

Open nchillal opened this issue 6 years ago • 2 comments

19c onwards ezconnect support passing protocol while connecting to the database, please provide a way for passing protocol as an argument while connecting to database. Right now we need to define it in tnsnames.ora file if we need to connect to the database via TCPS.

cx_Oracle.connect('hr', 'hrpwd', 'tcp', 'localhost:1567/orcl')
cx_Oracle.connect('hr', 'hrpwd', 'tcps', 'localhost:1521/orcl')

nchillal avatar Jul 28 '20 00:07 nchillal

You can pass the protocol as part of the EZ connect string when using 19c client. See the tech article Oracle Database 19c Easy Connect Plus Configurable Database Connection Syntax:

cx_Oracle.connect('hr', 'hrpwd', 'tcps://localhost:1521/orcl')

Is this what you wanted? I'm a bit confused because you seem to know about this syntax, and about editing tnsnames.ora files.

I don't think connect() should change. Possibly make_dsn() could, but that is a bigger topic of discussion.

cjbj avatar Jul 28 '20 00:07 cjbj

Oops yes thanks connect works. I tried makedsn and assumed connect also doesn't work. Yes it would be nice to have makedsn also work but that's not what I raised this issue for.

Thanks.

nchillal avatar Jul 28 '20 01:07 nchillal