Connecting to remote Oracle db via Python

Alexander Gattin xrgtn at yandex.ru
Fri Feb 18 17:33:53 EST 2011


Hello,

On Thu, Feb 17, 2011 at 02:40:22AM -0800, pstatham
wrote:
> I've installed the cx_Oracle module for Python
> and I'm trying to connect to my remote Oracle
> db.

Can you tnsping your remote Oracle DB
successfully?

> >>> uid = "scott"
> >>> pwd = "tiger"
> >>> service = "10.5.1.12:1521:PR10"
> >>> db = cx_Oracle.connect(uid + "/" + pwd + "@" + service)

Try 'tnsping service' or 'sqlplus uid/pwd at service'
in your Korn/Bourne/whoever shell 1st. If this
works, then cx_Oracle will work too.

'service' must be specified in system TNSNAMES
file or in your ~/.tnsnames.ora

-- 
With best regards,
xrgtn



More information about the Python-list mailing list