Connecting to remote Oracle db via Python
pstatham
pstatham at sefas.com
Thu Feb 17 05:40:22 EST 2011
Hi Guys,
I've installed the cx_Oracle module for Python and I'm trying to
connect to my remote Oracle db. Like so (username, password and ip
below aren't real don't worry)
>>> uid = "scott"
>>> pwd = "tiger"
>>> service = "10.5.1.12:1521:PR10"
>>> db = cx_Oracle.connect(uid + "/" + pwd + "@" + service)
This however gives me the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cx_Oracle.DatabaseError: ORA-12545: Connect failed because target host
or object
does not exist
I've also tried the following (jdbc string which works fine for java)
>>> service = "jdbc:oracle:thin:@10.5.1.12:1521:PR10"
>>> db = cx_Oracle.connect(uid + "/" + pwd + "@" + service)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the connect
identifier
specified
I'm not sure what's going on because I know that the ip, port and
service name. are correct? And as I said I can connect to it via JDBC
in Java.
Any ideas?
Thanks,
Paul
More information about the Python-list
mailing list