Select to view content in your preferred language

cx_Oracle and Direct Connect Issues

870
1
05-26-2010 12:42 PM
StevenHaslemore
Regular Contributor
Hi,

I am working in Python 2.5 and ArcMap 9.3.1 and am having issues getting geoprocessor tools to connect to direct connect feature classes after a cx_Oracle connection has been made.

The two databases are in Oralce 9i and on the same server

The general jist of the script is :

conn = cx_Oracle.connect("non_gis_user", "non_gis_pass", "non_gis_database")
rows = gp.searchCursor('direct_connect/feature')

If I remove the cx_Oracle connection the searchCursor opens fine, otherwise I this.

[INDENT]Underlying DBMS error[ORA-12154: TNS:could not resolve service name
No extended error.][/INDENT]

Is the cx_Oracle connection somehow overwriting the GP connection details in my Python session?
Is there a particular order I should be trying to initialise things?

I'm stumped.

Thanks,
Steven
0 Kudos
1 Reply
StevenHaslemore
Regular Contributor
Well I've found a work around, if you initialise a new dsn then everything seems to work fine.

[INDENT]host = 'host'
port = 1588
dbase = 'prod'
dsn = cx_Oracle.makedsn(host, port, dbase)
conn = cx_Oracle.connect("non_gis_user", "non_gis_pass", dsn)[/INDENT]

It's not ideal so still interested in thoughts or theories.
0 Kudos