dotConnect for PostgreSQL Documentation
Devart.Data.PostgreSql Namespace / PgSqlConnection Class / Host Property
Example

In This Topic
    Host Property (PgSqlConnection)
    In This Topic
    Gets or sets name or IP address of host of PostgreSQL database to which to connect.
    Syntax
    'Declaration
     
    Public Property Host As String
    public string Host {get; set;}

    Property Value

    The name or IP address of host of PostgreSQL database to which to connect. The default value is an empty string ("").
    Remarks
    You can also list multiple hosts, running in Hot Standby mode, with their ports in the Host parameter of the connection string, separated with commas, like "localhost:5433,db:5440,db:5441;User=postgres;Pwd=postgres;Database=test_multihosts;Target Session=Any". This can be used for load balancing and failover purposes. See Load Balancing and Failover for more information.
    Example
    The following example creates a PgSqlConnection and displays the host name.
    public void CreatePgSqlConnection()
    {
      string myConnString = "host=server;database=test;user id=postgres";
      PgSqlConnection myConnection = new PgSqlConnection(myConnString);
      myConnection.Open();
      MessageBox.Show("Host: " + myConnection.Host);
      myConnection.Close();
    }
    Public Sub CreatePgSqlConnection()
      Dim myConnString As String = _
        "host=server;database=test;user id=postgres"
      Dim myConnection As New PgSqlConnection(myConnString)
      myConnection.Open()
      MessageBox.Show("Host: " + myConnection.Host)
      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