IWorkspaceFactoryStatus

A couple of times in my recent past, I have experienced issues when I have a long running process working on SDE data that suddenly crashes.  On adding detailed logging in the code, I pinpointed the issue to the SDE connection being lost between the workstation and the server. One possible reason was our backup systems kicked in at mid-night causing the database to disconnect or maybe a network issue.

To add fault-tolerance in such cases, IWorkspaceFactoryStatus is a very handy interface. IWorkspaceFactoryStatus.WorkspaceStatus gives the current connected status to the SDE geodatabase. If the connection status is esriWCSDown, then use PingWorkspaceStatus method to check if the workspace can be reconnected to. If the PingWorkspaceStatus method returns a WorkspaceStatus of available, the open a new workspace. It is important to note that the old workspace can not be reclaimed.

ESRI Documentation is here and an interesting blog post on the topic is here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: