Accessing Data in Remote SDE

2989
12
01-20-2014 05:04 PM
KeithSandell1
New Contributor II
I have separate App and DB servers on Azure.

I need to run a python script on the App server that accesses an SDE featureclass on the DB server.

The python script was written on the DB server so it had direct access to SDE, but it needs to reside on the App server.

Basically need to change something like this:

sdeFC = r"C:\SDE_Connection.sde\DB.dbo.FeatureClass"

to something like this:

sdeFC = r"<remote db server>\SDE_Connection.sde\DB.dbo.FeatureClass"


---Suggestions on how to accomplish this?---

Thanks
Tags (2)
0 Kudos
12 Replies
KeithSandell1
New Contributor II
That is half correct. In your case you have created a sde connection file which is a recognized workspace type. Whether or not it actually references a valid database connection is irrelevant to the tool.

Running an arcpy.ListFeatureClasses() on an invalid sde connection will return an empty list.


Great. More undocumented features... I can't think of a single reason why you would not want an error raised if you execute a function on an invalid parameter. Isn't that the purpose of try/except...

Anyways, this is getting away from my original purpose.

I need ideas on how to access a remote instance of SDE from one cloud server to another.

It seems that creating a connection file would work, but how do I test it, more importantly how do the input parameters need to be structured?
0 Kudos
MathewCoyle
Frequent Contributor
It depends on the securities you have. Can you just reference the file system of your remote DB server? Have you referenced your remote DB on your application server?

Have you gone through these steps? I'm assuming you are using SQL Server based on your naming.
http://resources.arcgis.com/en/help/main/10.2/index.html#//015400000613000000
0 Kudos
KeithSandell1
New Contributor II
It depends on the securities you have. Can you just reference the file system of your remote DB server? Have you referenced your remote DB on your application server?

Have you gone through these steps? I'm assuming you are using SQL Server based on your naming.
http://resources.arcgis.com/en/help/main/10.2/index.html#//015400000613000000


SDE has been register with the instance of ArcGIS Server on the app server and I assumed that any connection string would need to make reference to the server on which the instance is running, but alas I found that it was not all the difficult and I'm ashamed to say it was actually brutally simple.

I just dug into the system files on the DB server and copied the connection file from the DB server and dropped it on the app server and it worked!

I was sure there was no way ArcGIS Server was that smart.

It just doesn't seem logical that you could copy a local copy of a file that references something on the same server, drop it somewhere else and have it work.

Well, problem solved, lesson learned. It always helps to bounce stuff off other folks, thanks for letting me abuse you all.
0 Kudos