2

I have a python code that uses ArcPy command "arcpy.TableToTable_conversion" to convert a database table to a dbf file.

arcpy.TableToTable_conversion

The input table is from a SQL Server database through an odc Database Connection in ArcCatalog.

"Database Connections\\myDb_DEV.odc\\dbo.V_Locations"

When run straight from ArcCatalog, the code worked perfectly. However, after it was published as a Geoprocessing service on ArcGIS Server 10, it failed to run.

Error
Error Executing Task. Error executing tool.: : Failed to execute. Parameters are not valid. ERROR 000732: Input Rows: Dataset "Database Connections\myDb_DEV.odc\dbo.V_Locations" does not exist or is not supported Failed to execute (TableToTable). Failed to execute (ExportToBOMAWS).

Code: 500

Could anybody help with any idea why and how to make it work as geoprocessing service?

3
  • I have been struggling for days. Please help out.
    – alextc
    Commented Aug 14, 2012 at 23:15
  • 1
    I don't have access to ArcGIS Server to test but I think you need to make sure that Catalog on your server machine is seeing the table identically to how Catalog on your desktop machine sees it. Right click on the properties of that table using Catalog on both machines and see if the full path and sde connection parameters are absolutely identical.
    – PolyGeo
    Commented Aug 15, 2012 at 6:31
  • right, the table to table conversion works, but only creates an empty table... i'm just stuped here.
    – user26403
    Commented Jan 30, 2014 at 21:08

2 Answers 2

2

When authoring a Python script that will be later published as a GP service, you have to specify the .sde / .odc connection file (you have to copy it from C:\Users\%user%\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog) as your workspace (copy it from . Then use os.path.join to reference a database object such as a table. When you use "Database Connections", it is not something your script would recognize since you don't run from ArcMap or ArcCatalog session.

import arcpy, os
oleworkspace = r"C:\GIS\ole.odc"
gdbworkspace = r"C:\GIS\Temp\test.gdb"
indata = os.path.join(oleworkspace,"dbo.V_Locations")
outputdata = "V_Locations_output"
arcpy.TableToTable_conversion(indata,gdbworkspace,outputdata)

What happens when you publish a geoprocessing service

1

If myDb_DEV.odc is the server name, then I have seen the same error and the reason for it is because I did not add .sde extension behind my server name.

Check your servername by looking at the server properties->Editor Tracking.

The Realm: @ text field is usually the name you should use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.