AGS 10.1 Publishing geoprocessing service that references data on sde connection

Discussion created by topomat on Mar 6, 2013
Latest reply on Aug 15, 2014 by mkosior
I'm publishing a geoprocessing service (python script), which constains a connection to an SDE database.
I have declared (imported .sde file) in Arcgis server manager and checked "Same as publisher database connection".
I then publish the service.
Is this the correct way of publishing script + data from arcsde on 10.1 Server ?

I run into the following problem.
The script publishes fine and works on the server, accessing the arcsde data as planned.
However, when I try to publish the same script again under another name (the idea is to make changes to it), the script doesn't work. I checked the connection to the data in the python script on the server and see that it is absent (as on screen capture). On the first publishing, I had : g_ESRI_variable_1 = os.path.join(arcpy.env.packageWorkspace, u'mySdeFileName.sde')

Why is this ? What am I doing wrong ?