English

How To: Determine which ArcSDE client version is being used with Java SDE SDK

Summary

In certain cases where multiple clients are accessing a given program, the client version being used may need to be determined to verify that the correct objects are being used. Instructions provided describe how to determine which client version is being used.

Below is code that tests the ArcSDE version in the Java SDE API.

Procedure

The main classes being used are:

com.esri.sde.sdk.client.SeConnection
com.esri.sde.sdk.client.SeRelease

  1. Define the SDE connection properties to establish the SeConnection.

    Code:
    import com.esri.sde.sdk.client.*;
    public class GetSDEReleaseInformation {

    private static SeConnection conn = null;
    public static void main(String[] args) {
    // properties to connect to ArcSDE
    String host = "myserver";
    int instance = 5151;
    String user = "user";
    String pass = "pass";
    String database = "";

    connectToSDE(host, instance, database, user, pass);

    }
    public static void connectToSDE(String host, int instance, String database, String username, String password)
    {
    try
    {
    conn = new SeConnection(host, instance, database, username, password);
    }
    catch (SeException e) {
    System.out.println("Connection does not exist");

    }
    }

    }


  2. Now that the SeConnection object is created, the getRelease() method can be called. This returns the SeRelease object.

    Code:
    SeRelease release = conn.getRelease();

  3. With the SeRelease object, the methods to retrieve the actual version can be called.

    Code:
    /*
    * getMajor() - returns int value for the Major Release
    * getMinor() - returns int value for the Minor Release
    * getRelease() - returns int value for the Release Number
    * getBugFix() - returns int value for the Bug Fix Release Number
    * getDesc() - returns String description for the release
    */
    int major = release.getMajor();
    int minor = release.getMinor();
    int rel = release.getRelease();
    int bugFix = release.getBugFix();
    String desc = release.getDesc();

    System.out.println("*********** ArcSDE Information ***************");
    System.out.println(major + "." + minor + desc);
    System.out.println("Release Number: " + rel);
    System.out.println("Bug Fix Version: " + bugFix);

  4. Below is the output for this particular sample for ArcSDE 9.3.1 for Oracle 10g.

    *********** ArcSDE Information ***************
    9.3 for Oracle10g Build 1632(Oracle) Thu Feb 26 12:05:37 2009
    Release Number: 93004
    Bug Fix Version: 1

Related Information