'Declaration Public Overrides Property ConnectionString As String
public override string ConnectionString {get; set;}
'Declaration Public Overrides Property ConnectionString As String
public override string ConnectionString {get; set;}
Resetting the ConnectionString on a closed connection resets all connection string values (and related properties) including the password. For example, if you set a connection string that includes "User=postgres", and then reset the connection string to "Data Source=localhost", the UserId property is no longer set to "postgres".
The connection string is parsed immediately after being set. If errors in syntax are found when parsing, a runtime exception, such as System.ArgumentException, is generated. Other errors can be found only when an attempt is made to Open the connection.
The ConnectionString is similar to an OLE DB connection string. Values may be delimited by single or double quotes, (for example, name='value' or name="value"). Either single or double quotes may be used within a connection string by using the other delimiter, for example, name="value's" or name= 'value"s', but not name= 'value's' or name= ""value"". All blank characters, except those placed within a value or within quotes, are ignored. Keyword value pairs must be separated by a semicolon (;). If a semicolon is part of a value, it also must be delimited by quotes. No escape sequences are supported. The value type is irrelevant. Names are not case sensitive. Arguments names may occur only once in the connection string.
The following table lists the valid names for values within the ConnectionString.
Name | Description |
---|---|
AllowDateTimeOffset -or- Allow DateTimeOffset | Determines whether to use the System.DateTimeOffset type instead of System.DateTime when PgSqlDataReader returns a timestamptz value. |
Character Set | A character set used by the client. Actually, if this property is enabled, then the "SET NAMES <Charset>" query is executed on establishing a connection. Default value is an empty string. That means there is no action performed with charset on the client and on the server. |
ApplicationName | The client application name. |
Connection Lifetime | When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by Connection Lifetime. The default value is 0. |
Connect Timeout -or- Connection Timeout | The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. The default value is 15. |
Data Source -or- Host -or- Server | The name or IP address of host of PostgreSQL database to which to connect. |
Database | The name of the database. If this parameter is not specified, it is assumed that name of the database is same as user name. |
Default Command Timeout | The default time in seconds to wait while trying to execute a command before terminating the attempt and generating an error. 0 indicates no limit. |
Default Fetch All | Default value of the FetchAll property of PgSqlCommand instances, created via the CreateCommand method. If the FetchAll mode is enabled, PgSqlDataReader object retrieves all the querried data from the server on execution. |
Enlist | Determines whether the connection is automatically enlisted in the current distributed transaction. The default value is true. This parameter is not available in Mobile Edition. This parameter is also not supported in .NET Standard 1.3 compatible assembly. |
Force IPv4 | Determines whether authentication by IPv6 address is allowed, or IPv4 address is always used. The default value is false. |
Initial Schema | The name of the schema to be used once a connection is opened. You can change it later if you need. By default it is schema 'Public'. |
Ignore Unnamed Parameters | Specifies whether to disable treating the '?' character in CommandText as an unnamed parameter. |
Initialization Command | Specifies a database-specific command that should be executed immediately after establishing the connection. |
Integrated Security | Determines whether to use a secure authentication with single sign-on (GSSAPI or SSPI, depending on the server). |
Join Statement Notices | Determines whether all the notices, raised during the statement execution, will be returned together in one InfoMessage event after the statement execution, or each notice will be returned in a separate InfoMessage event. |
Keep Alive | Specifies whether to send TCP keep-alive packets and the interval at which they are sent in seconds. Default value is 0, which means that the packets are not sent. |
Keep Connected | Specifies whether to perform periodic ping calls to PostgreSQL when a connection is inactive (in order to always know if the connection is still valid) and the interval at which the calls are made in seconds. Default value is 0, which means that the calls are not made. |
License Key | Specify your license key in this parameter. This is required only when using .NET Standard compatible assemblies. See Licensing .NET Standard (.NET Core) Projects for more information. |
Max Pool Size | The maximum number of connections allowed in the pool. Setting the Max Pool Size value of the ConnectionString can affect performance. The default value is 100. In the case of forgotten open transactions, the number of connections can exceed Max Pool Size. |
Min Pool Size | The minimum number of connections allowed in the pool. The default value is 0. |
Password | The password for the PostgreSQL login account. |
Persist Security Info | Indicates if security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. |
Pooling | If true, by default, the PgSqlConnection object is drawn from the appropriate pool or is created and added to the appropriate pool. |
Port | The port of PostgreSQL database to which to connect. The default value is 5432. |
Proxy Host | The host name or IP address of proxy server. |
Proxy Password | The password for the proxy server account. |
Proxy Port | The port number of the proxy server. The default value is 3128. |
Proxy User | The proxy server account name. |
Protocol | The Frontend/Backend Protocol version. Available values are 2 and 3. Set the parameter to 2 for the protocol version 2.0 or to 3 for protocol version 3.0. Can be applied only for PostgreSQL server versions 7.4 or higher, for earlier versions of PostgreSQL this parameter must be explicitly set to 2. To execute several statements in the same query set procol to 2 version. The default value is 3. |
Proxy Host | The host name or IP address of proxy server. |
Proxy Password | The password for the proxy server account. |
Proxy Port | The port number of the proxy server. The default value is 3128. |
Proxy User | The proxy server account name. |
Run Once Command | A command to execute when the connection is opened the first time and not executed when the connection is taken from the pool. |
Readonly | Determines whether the connection is read-only (allows only SELECT statements). |
SSH Authentication Type | Client authentication method. See Devart.Common.SshAuthenticationType for additional information. |
SSH Cipher List | List of ciphers that client agrees to use. See PgSqlConnectionStringBuilder.SshCipherList for additional information. |
SSH Host | Name or ip address of SSH server. |
SSH Host Key | The location of the public key on the client side to verify the server host key during establishing connection. |
SSH Passphrase | Passphrase for the client key. |
SSH Password | User password on SSH server. |
SSH Port | Number of port on SSH server to connect. |
SSH Private Key | Location of the private key to use. |
SSH Strict Host Key Check | Indicates whether the host key is verified during establishing connection. |
SSH User | User id on SSH server. |
SSL CA Cert | The location of the authority SSL certificate. |
Ssl Cert | The location of the client SSL certificate. |
Ssl Cipher List | The list of ciphers that client agrees to use. |
Ssl Key | The location of the user's private key. |
Ssl Mode | SSL connection priority. May be Disable, Allow, Prefer, and Require. The default value is Disable, which means that only an unencrypted SSL connection will be attempted. |
SSL TLS Protocol | Specifies the maximal TLS version to report to the server when establishing a connection. Supported values are "1.0", "1.1", and "1.2". The default value is "1.1". |
Target Session | Determines how the host to connect to is selected from the list when multiple hosts are specified in the Host connection string parameter. See Load Balancing and Failover for more information. |
Transaction Error Behavior | Determines whether to roll back a transaction automatically when an error occurs inside the transaction. |
Transaction Scope Local | If there are several connections with the same connection string (which includes "Transaction Scope Local=true;") within a scope of TransactionScope, our provider will use only one connection internally. The default value is false. Not available in Mobile Edition. This parameter is also not supported in .NET Standard 1.3 compatible assembly. |
Unicode | If true, sets client charset to UTF8 and converts client data according to this charset. Default value is false in the assemblies for Full .NET Framework, but true for .NET Standard compatible assemblies. |
UnpreparedExecute | If true, unprepared execute mode is used in PgSqlCommand instances by default. |
User ID -or- User | The PostgreSQL login account. |
Validate Connection | Specifies whether to validate connections that are being got from the pool. |
public void CreatePgSqlConnection() { string myConnString1 = "host=server;database=test;user id=postgres;"; PgSqlConnection pgConnection1 = new PgSqlConnection(myConnString1); pgConnection1.Open(); }
Public Sub CreatePgSqlConnection() Dim myConnString1 As String = _ "host=server;database=test;user id=postgres;" Dim pgConnection1 As New PgSqlConnection(myConnString1) pgConnection1.Open() 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