dotConnect for Oracle Documentation
Devart.Data.Oracle Namespace / OracleConnection Class / Server Property

In This Topic
    Server Property (OracleConnection)
    In This Topic
    Gets or sets the name of TNS alias of the Oracle database to which to connect.
    Public Property Server As String
    public string Server {get; set;}

    Property Value

    The name of TNS alias of the Oracle database to which to connect. The default value is an empty string ("").

    In OracleConnection.Direct mode this property represents host name or IP address of the database server.

    In this property you can choose a Home to work with. Homes are enumerated in file named tnsnames.ora. You can use Server property to specify the server detailed instead of alias:
    This is particularly useful for Instant Client, which can be used with Server property set this way. dotConnect for Oracle searches for Instant Client in directories specified by PATH environment variable.

    For a OracleConnectionStringBuilder.Direct mode connections allow shortened connection string form, specifying several other parameters in the Server parameter in one of the following ways:

    <protocol>://<domain_name_or_IP_address>:<port>:<SID> or <protocol>://<domain_name_or_IP_address>:<port>/<Service_name>

    Here protocol can be either tcps for SSL connections or ssh for SSH connections. For other cases, the <protocol>:// part is omitted.

    Every part except the <domain_name_or_IP_address> is optional, and every part except protocol can be specified via it's own connection string parameter.

    For example:

    The following example creates an OracleConnection and displays the server name.
    public void CreateOraConnection()
      string myConnString = "User ID=scott; Password=tiger; Data Source=ora";
      OracleConnection myConnection = new OracleConnection(myConnString);
      MessageBox.Show("Server: " + myConnection.Server);
    Public Sub CreateOraConnection()
      Dim myConnString As String = _
        "User ID=scott; Password=tiger; Data Source=ora"
      Dim myConnection As New OracleConnection(myConnString)
      MessageBox.Show("Server: " + myConnection.Server)
    End Sub

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also