rdunfey

Create ArcSDE Connection File - Use Feature Class?

Discussion created by rdunfey on Dec 1, 2011
I want to add a feature class from our database to the FlexViewer application, usually this isn't a problem because all our users connect to the database with a read only password, I would just add the feature class via a reaad only connection to the MXD and publish as a service.  However, this database restricts access as to what can be read, each user can see different feature in the feature class.  So I thought I would publish a geoporcessing model that prompts the user for their username and password, and expose the model via the GP widget for the flex viewer.  At the moment, I am stuck creating the model.  I can make the connection file, but I can't seem to reference feature classes that exist within the database?  The model remains white.

How do I use the result of the 'Create ArcSDE Connection File' tool in model builder to work with a feature class contained within the database I'm conencting to?

I've exported the model as python, but it looks ok to me, am I missing something obvious?


# Set the necessary product code
import arceditor


# Import arcpy module
import arcpy

# Script arguments
Username = arcpy.GetParameterAsText(0)

Password = arcpy.GetParameterAsText(1)

# Local variables:
Test_sde = Username
Connections = "\\\\myserver.com\\somewhere\\Scripts\\Connections"
PROSPECTS_GIS = "PROSPECTS_GIS"
Output = "%ScratchWorkspace%\\Output"

# Process: Create ArcSDE Connection File
arcpy.CreateArcSDEConnectionFile_management(Connections, "Test", "DBSERVER.COM", "4150", "DB", "DATABASE_AUTH", Username, Password, "SAVE_USERNAME", "sde.DEFAULT", "SAVE_VERSION")

# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(PROSPECTS_GIS, Output, "", "", "")

Outcomes