Summary
Creates a database connection file to connect to an enterprise geodatabase using an ArcSDE service.
Usage
The ArcSDE Connection File Name must include an .sde file extension.
When valid connection information is entered, the tool populates the versions list with the geodatabase versions that the connected user has permissions to access.
- If you want to prevent your connection information from being saved in the Results window or stored in the geoprocessing history log files, disable history logging and save the connection file without saving any connection information you don't want exposed.
This tool should only be used to create application server (ArcSDE service) connections to a 10.2.2 or earlier release geodatabase. If you want to connect to a 10.3 or later release geodatabase, or connect directly to a 10.2.2 or earlier release geodatabase, use the Create Database Connection tool instead.
Syntax
CreateArcSDEConnectionFile_management (out_folder_path, out_name, server, service, {database}, {account_authentication}, {username}, {password}, {save_username_password}, {version}, {save_version_info})
Parameter | Explanation | Data Type |
out_folder_path | The folder path where the .sde file will be stored. | Folder |
out_name | The name of the connection file. Use the .sde file extension. | String |
server | The name of the machine where the ArcSDE application server is installed. | String |
service | The ArcSDE service name or TCP port number. | String |
database (Optional) | The name of the database to connect to. Do not provide a database name when connecting to Oracle. | String |
account_authentication (Optional) |
| Boolean |
username (Optional) | Database user name to connect with when 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. By default, connections are made to the DEFAULT version. | String |
save_version_info (Optional) |
| Boolean |
Code sample
CreateArcSDEConnectionFile example 1 (Python window)
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')
CreateArcSDEConnectionFile example 2 (stand-alone script)
The following stand-alone script is an example of how to apply the CreateArcSDEConnectionFile function in scripting.
# CreateArcSDEConnection.py
# Description: Simple example showing use of CreateArcSDEConnectionFile tool
# 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)
Environments
Licensing information
- ArcGIS Desktop Basic: No
- ArcGIS Desktop Standard: Yes
- ArcGIS Desktop Advanced: Yes