Script to change database connection parameters to direct connect

474
3
02-07-2012 05:22 AM
BrittneyVenetucci
New Contributor
Hi all,

I have created a tool with the help of some of my fellow GIS users on this forum, that repairs broken data sources in an mxd based on the location of the mxd, old path connection and new path connection.

With the release of 10.1, all of our databases are moving to direct connect. Previously, we  were not connecting using a direct connect.

My question to you all is there a way to change the connection settings from the old connection to the direct connect using python?

I have included a document containing two screenshots, one showing the way we connect now and one showing how we are going to connect in the near future..

Brittney
Tags (2)
0 Kudos
3 Replies
MichaelVolz
Esteemed Contributor
Brittney:

Have you thought of trying to use the replaceDataSource method to solve this problem?  I'm thinking you could create the new direct connect database connections in ArcCatalog that would correspond to your existing database connections.  Then in your code, get each feature class in your mxd that originate from this database and replace the old connection with the new direct connection.  Use the Validate = TRUE property so only those existing connections that you have created a corresponding direct connection for will be resourced (if set to FALSE, you will get broken links if the connection strings have not been already created in ArcCatalog).  I hope this helps.
0 Kudos
BrittneyVenetucci
New Contributor
See attached python script. My script already uses this function.. I was just trying to figure out a way to change the connection properties to a direct connect in python.
0 Kudos
MichaelVolz
Esteemed Contributor
I believe as long as the new connection that you created in ArcCatalog has the direct connection parameters specified, the source should then be changed to a direct connection.
0 Kudos