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

Host Property (PgSqlConnection)
Gets or sets name or IP address of host of PostgreSQL database to which to connect.
Syntax
'Declaration
 
Public Property Host As String
 

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
See Also