Create ArcSDE Connection File (Data Management)
Summary
Creates an ArcSDE connection file for use in connecting to ArcSDE geodatabases.
Usage
-
Although you can enter any file extension for the ArcSDE Connection File Name, you must use the standard file extension .sde in order for it to be recognised correctly by ArcGIS.
-
When valid connection information is entered the tool will connect to the ArcSDE server in order to populate the versions list with versions the connected user has permissions to connect to.
-
Please see A quick tour of connections to ArcSDE geodatabases for a more complete explanation of ArcSDE connection properties.
- If you want to prevent your connection information from being saved in the Results window or stored in the geoprocessing history log files, you will need to disable history logging and save the ArcSDE Connection file without saving the connection information you wish to hide.
Syntax
Parameter | Explanation | Data Type |
out_folder_path |
The folder path where the .sde file will be stored. | Folder |
out_name |
The name of the ArcSDE Connection file. Use the .sde file extension. | String |
server |
The ArcSDE Server machine name. | String |
service |
The ArcSDE Service name or TCP port number. | String |
database (Optional) |
For non-Oracle databases only. The DBMS database to connect to. | String |
account_authentication (Optional) |
| Boolean |
username (Optional) |
Database username to connect with using Database Authentication. | String |
password (Optional) |
The database user password when using Database Authentication. | Encrypted String |
save_username_password (Optional) |
| Boolean |
version (Optional) |
The Geodatabase version to connect to. | String |
save_version_info (Optional) |
| Boolean |
Code Sample
The following Python window script demonstrates how to use the CreateArcSDEConnectionFile function in immediate mode.
import arcpy arcpy.CreateArcSDEConnectionFile_management(r'c:\connectionFiles', 'gpserver', '5151', '', 'toolbox', 'toolbox', 'SAVE_USERNAME', 'SDE.DEFAULT', 'SAVE_VERSION')
The following stand-alone script is a simple example of how to apply the CreateArcSDEConnectionFile function in scripting.
# CreateArcSDEConnection.py # Description: Simple example showing use of CreateArcSDEConnectionFile tool # Author: ESRI # Import system modules import arcpy # Set variables folderName = r"c:\connectionFiles" fileName = "Connection to gpserver.sde" serverName = "gpserver" serviceName = "5151" databaseName = "" authType = "DATABASE_AUTH" username = "toolbox" password = "toolbox" saveUserInfo = "SAVE_USERNAME" versionName = "SDE.DEFAULT" saveVersionInfo = "SAVE_VERSION" #Process: Use the CreateArcSDEConnectionFile function arcpy.CreateArcSDEConnectionFile_management (folderName, fileName, serverName, serviceName, databaseName, authType, username, password, saveUserInfo, versionName, saveVersionInfo)