DB2 10.5 for Linux, UNIX, and Windows

DB2Connection.ServerVersion Property

Gets a string containing the version 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 ServerVersion As String
[C#]
public string ServerVersion {get;}
[C++]
public: __property String* get_ServerVersion();
[JScript]
public function get ServerVersion() : String;

Property value

The version 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 ServerVersion property takes the form '##.##.####,' where the first two digits are the major version, the next two digits are the minor version, and the last four digits are the release version.

Example

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

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

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