DB2 10.5 for Linux, UNIX, and Windows

DB2Connection.ServerType Property

Gets a string containing the type of the server to which the client is connected.

Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax

[Visual Basic]
Public ReadOnly Property ServerType As String
[C#]
public string ServerType {get;}
[C++]
public: __property String* get_ServerType();
[JScript]
public function get ServerVersion() : String;

Property value

The type of the connected server. The default value is an empty string ("") until the connection is opened.

Exceptions

Exception type Condition
InvalidOperationException The connection is closed.

Remarks

The ServerType property is a string that is specific to the data server type for this connection.

Example

[Visual Basic, C#] The following example creates a DB2®Connection and displays the ServerType.

[Visual Basic]
Public Sub CreateDB2Connection()
     Dim myConnectString As String = "DATABASE=SAMPLE;"
     Dim myConnection As New DB2Connection(myConnectString)
     myConnection.Open()
     MessageBox.Show("ServerType: " + myConnection.ServerType)
     myConnection.Close()
 End Sub

[C#]
public void CreateDB2Connection()
 {
    string myConnectString = "DATABASE=SAMPLE;";
    DB2Connection myConnection = new DB2Connection(myConnectString);
    myConnection.Open();
    MessageBox.Show("ServerType: " + myConnection.ServerType);
    myConnection.Close();
 }