Summary
Creates a connection string that geoprocessing tools can use to connect to a database or an enterprise geodatabase.
Usage
Use this tool, instead of connection files, when you have an automated geoprocessing workflow (script or model) that uses database or enterprise geodatabase datasets. You can generate a connection string that can be used as input to any geoprocessing tool that supports the specified dataset type, rather than using a path to the database through the connection file workspace.
Connections from ArcGIS to Altibase and Netezza are no longer supported.
Syntax
CreateDatabaseConnectionString(database_platform, instance, {account_authentication}, {username}, {password}, {database}, {object_name}, {data_type}, {feature_dataset}, {schema}, {version_type}, {version}, {date})
Parameter | Explanation | Data Type |
database_platform | Specifies the database platform to which the connection will be made.
| String |
instance | The database server or instance to which the connection will be made. This parameter value depends on the Database Platform parameter value chosen. | String |
account_authentication (Optional) | Specifies the type of authentication that will be used.
| Boolean |
username (Optional) | The database user name that will be used when using database authentication. | String |
password (Optional) | The database user password that will be used when using database authentication. | Encrypted String |
database (Optional) | The name of the database to which you will connect. This parameter only applies to PostgreSQL and SQL Server platforms. | String |
object_name (Optional) | The name of the dataset or object in the database to which the connection string will point. This connection string can be used as a path to the specified dataset. | String |
data_type (Optional) | The type of dataset or object referred to in the dataset object name. If there are multiple objects with the same name in the database, you may need to specify the data type of the object for which you want to make a connection string. | String |
feature_dataset (Optional) | The name of the feature dataset containing the dataset or object for which you want to make a connection string. If the dataset is not in a feature dataset (for example, if it's at the root of the database), do not specify a target feature dataset. | String |
schema (Optional) | The user schema geodatabase to which you will connect. This option only applies to Oracle databases that contain at least one user-schema geodatabase. The default value for this parameter is to use the sde schema (master) geodatabase. | String |
version_type (Optional) | Specifies the type of version to which you will connect. This parameter only applies when connecting to a geodatabase.
Note:If Historical is selected and a name is not provided, the default transactional version is used. If Point in time is selected and a date is not provided in the Date and Time parameter, the default transactional version is used. | String |
version (Optional) | The geodatabase transactional version or historical marker to connect to. The default option uses the default transactional version. If you choose a branch version type, the connection is always to the default branch version. | String |
date (Optional) | The value representing the date and time that will be used to connect to the database when working with archive-enabled data. Dates can be entered in the following formats:
Note:
| Date |
Derived Output
Name | Explanation | Data Type |
out_connection_string | The CIMDATA connection string. | String |
Code sample
The following Python window script demonstrates how to use the CreateDatabaseConnectionString function in immediate mode.
import arcpy
data_conn_str = arcpy.CreateDatabaseConnectionString_management("SQL_SERVER",
"utah",
"DATABASE_AUTH",
"gdb",
"gdb",
"",
"gdb.roads")
arcpy.Buffer_analysis(data_conn_str, r"c:\temp\Buffers.shp", "10 Miles")
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes