Select to view content in your preferred language

Script GIS Database Connection

1328
2
02-07-2011 10:20 AM
TedCronin
MVP Alum
Is there an ability to script creating a connection to a database, dynamically each time the script runs?  I am finding at 10 that my .odc files are getting corrupted (only on Server 2008 R2), so I need to recreate them often, so it would be nice to have a similar capability where I can just script the connection each and every time, then allow it to live only within the time that the script is running, then kill it once the script ends.  Ideally, scriptable via python.  Can we do this today?
0 Kudos
2 Replies
RussellBrennan
Esri Contributor
Hi Ted,

There is no option for creating OLE DB connections through Python. We do have a create ArcSDE connection file tool at 10.

Also, here is a link to an ArcObjects sample that will create an ArcSDE connection file at 9.3/10. With a little bit of tweaking you should be able to get this to work with odc files.
http://blogs.esri.com/Dev/blogs/geoprocessing/archive/2008/09/24/Tips-and-Tricks-_2D00_-Creating-Arc...

Unfortunately ArcObjects/Java is not my forte so if you do go this route you may want to post in one of the programming forums for assistance.
0 Kudos
TedCronin
MVP Alum
Perhaps creating .odc files could be an enhancement to finish up this stack, since we can already create .sde connections.  Thanks Russell.

I too, see no need to pursue anything outside of python.
0 Kudos