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

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.
    Syntax
    'Declaration
     
    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 ("").
    Remarks

    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:
    (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = SERVER)(PORT = 1521))) (CONNECT_DATA = (SID = ORCL)))
    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:

    Server=192.168.10.137:1521/ORACLE19
    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);
      myConnection.Open();
      MessageBox.Show("Server: " + myConnection.Server);
      myConnection.Close();
    }
    Public Sub CreateOraConnection()
      Dim myConnString As String = _
        "User ID=scott; Password=tiger; Data Source=ora"
      Dim myConnection As New OracleConnection(myConnString)
      myConnection.Open()
      MessageBox.Show("Server: " + myConnection.Server)
      myConnection.Close()
    End Sub
    Requirements

    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