Home    |    Concepts   |   API   |   Samples
Concepts > Database Connections
ArcSDE Services

A service can be specified in several ways. By default, the service is named in the SDEHOME/etc/services.sde file. However, you can override the service in the services.sde file in three ways:

  • The SDEINSTANCE environment variable can be set to the name of a service.

    setenv SDEINSTANCE esri_sde3

  • The sdemon command "-i <service>" option accepts the service name as its argument.
     
  • The sdemon command "-H <sde_directory>" option specifies the home directory (normally one not specified by SDEHOME) within which the etc/services.sde file contains the service name.

Once giomgr starts, it listens on the port number assigned to the service for ArcSDE client connection requests. When a connection request is received, the giomgr verifies the user and password and spawns a gsrvr process and assigns it a new port number on which to communicate.

Note: Please be sure to read the ArcSDE service topics in the ArcGIS Server or ArcGIS Desktop help if you have not already done so.

The services.sde file

The services.sde file contains the unique instance name and the network port number and protocol on which the giomgr accepts connection requests to the instance. By default, the services.sde file instance name is esri_sde with a 5151 port number using a TCP/IP protocol.

#
# ESRI SDE Remote Protocol
#

esri_sde 5151/tcp

The system services file must contain a service name that matches the instance name in the services.sde file in the etc subdirectory of the ArcSDE home directory. When the connection is started, the system services file is searched for a service name that matches the instance name in the services.sde file. If a match is not found, an error is returned.

Location of system services file
UNIX® (all platforms) /etc/services
Windows XP or 2003 C:\windows\system32\drivers\etc\services

The system services file contains many service names, at least one of which must match your ArcSDE instance name. The service name must be entered into the services file on both the ArcSDE server and the client machines. You may use the NIS (Network Information Service) /etc/services file if you are running yellow pages, in which case you do not have to redundantly update the client and server /etc/services files.

Here is an example from a UNIX /etc/services file that contains two ArcSDE instances:

esri_sde 5151/tcp sde # SDE default instance iomgr port.

esri_sde2 5153/tcp sde2 # SDE instance # 2 iomgr port.

This defines two instance names: esri_sde and esri_sde2. Each instance has its own home directory with the instance name in the services.sde file.

Clients and services

The service argument of the SE_connection_create function accepts the instance directly unless it is NULL. In that case, it uses the instance defined in the SDEINSTANCE variable. If the SE_connection_create instance argument is NULL and SDEINSTANCE is undefined, the instance name defaults to esri_sde.

Note: As used here, the terms instance and service are synonymous. The term instance is a legacy term from SDE 2. The term service is the more current name and is used in concept discussions. However, some functions and ArcSDE administration commands may still have references to instance.

The example below creates a connection to the sdedev instance.
 
CHAR server[30] = "elvis";

CHAR instance[30] = "sdedev";

CHAR username[30] = "businessmap";

CHAR password[30] = "mapserver";

SE_ERROR error;

SE_CONNECTION connect;

SE_connection_create(server, instance, NULL, username, password, error, connect);

OR

setenv SDEINSTANCE sdedev

CHAR server[30] = "elvis";

CHAR username[30] = "businessmap";

CHAR password[30] = "mapserver";

SE_ERROR error;

SE_CONNECTION connect;

SE_connection_create(server, NULL, NULL, username, password, error, connect);
feedback | privacy | legal