Systems developed for arcengine will connect to the spatial database. Here we record the link methods and processes.
Directly run the Code:
// Use the connection property to create propertyset ipropertyset propertyset = new propertysetclass (); propertyset. setproperty ("server", "cuillin"); propertyset. setproperty ("instance", "esri_sde"); propertyset. setproperty ("user", "Scott"); propertyset. setproperty ("password", "Tiger"); propertyset. setproperty ("version", "SDE. default "); propertyset. setproperty ("authentication_mode", "DBMS"); // create an SDE workspace factory and open the workspace // type factorytype = type. gettypefromprogid ("esrisponcesgdb. sdeworkspacefactory "); // var workspacefactory = (iworkspacefactory) activator. createinstance (factorytype); iworkspacefactory workspacefactory = new sdeworkspacefactory (); iworkspace workspace = workspacefactory. open (propertyset, 0 );
In this example, you need to set the user, password, database, server, instance, version, historical_name, historical_timestamp, and authentication_mode. Of course, some attributes can be omitted.
The following is a brief description of the data.
"Server"-name of the SDE service to be connected
"Instance"-instance to be connected
"Database"-name of the connected database
"User"-connection username
"Password"-password of the linked user
"Authentication_mode"-connection credential Authentication mode. It can be set to "OSA" and "DBMS"
"Version"-connect to the transaction version. You can set a string to describe the transaction version name.
"Historical_name"-connect to a previous version. Set a value of the string type, which is the name of a previous version.
"Historical_timestamp"-creates a version connection for a historical event point. The parameter indicates the date and time of the historical timestamp.
Note:
1. The "Database" parameter is optional, but this parameter must be set if multiple databases (such as SQL Server) exist.
2. If the "authentication_mode" parameter is set to "OSA", the "user" and "password" parameters do not need to be set. "OSA" indicates System Identity Authentication. the user's operating system creden establish a database link.
3. a workspace link can be connected to only one version. There are only three attribute parameters ("version", "historical_name", and "historical_timestamp") available.