dotConnect for Snowflake Documentation
Devart.Data.Snowflake Namespace / SnowflakeConnection Class / ConnectionString Property
Example

On this page
    ConnectionString Property (SnowflakeConnection)
    On this page
    Gets or sets the string used to open a Snowflake connection.
    Syntax
    'Declaration
     
    Public Shadows Property ConnectionString As String
    public new string ConnectionString {get; set;}

    Property Value

    The connection string that includes the parameters needed to establish the initial connection. The default value is an empty string ("").
    Remarks
    When ConnectionString property is assigned a value, connection closes. Many of the connection string values have corresponding properties. When the connection string is set, all of these properties are updated, except when an error is detected. In this case, none of the properties are updated. SnowflakeConnection properties return only those settings contained in the ConnectionString.

    Resetting the ConnectionString on a closed connection resets all connection string values (and related properties).

    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
    Authentication Type Specifies the authentication method: Basic (user name and password, the default), KeyPair (RSA key pair), OAuth2 (OAuth 2.0 refresh token), or OAuth2Interactive (OAuth 2.0 with a sign-in through a browser when the refresh token is empty). See SnowflakeAuthenticationType for more information.
    Client Id Specifies the client ID of the Snowflake OAuth security integration. Required for the OAuth2 and OAuth2Interactive authentication methods.
    Client Secret Specifies the client secret of the Snowflake OAuth security integration. Required for the OAuth2 and OAuth2Interactive authentication methods.
    Database Specifies the database to connect to. If it is not specified, the default namespace of the user is used.
    Domain Specifies the Snowflake account URL, for example, myorg-myaccount.snowflakecomputing.com, or the account identifier, for example, myorg-myaccount. The .snowflakecomputing.com suffix is added if it is missing.
    Enlist Determines whether the connection is automatically enlisted in the current transaction context (TransactionScope). The default value is true.
    Failover Retries Specifies the maximum number of times a request to Snowflake is sent again after a network error. Requests are not sent again while a transaction is open. The default value is 7.
    License Key Specifies the activation key of dotConnect for Snowflake. It is required when the product is not activated on the machine, for example, in build or deployment scenarios.
    Passphrase Specifies the passphrase of an encrypted private key for the KeyPair authentication method.
    Password Specifies a programmatic access token (PAT) or the password of the Snowflake user. A password works only if the user isn't required to use multi-factor authentication. Required for the Basic authentication method.
    Private Key Specifies the RSA private key of the user in the PEM format (PKCS#1 or PKCS#8) for the KeyPair authentication method: either the key itself, including the -----BEGIN and -----END lines, or the path to the key file.
    Refresh Token Specifies the OAuth 2.0 refresh token for the OAuth2 and OAuth2Interactive authentication methods. Required for OAuth2. For OAuth2Interactive, it can be empty: if the application can show a browser, the provider opens the browser to sign in to Snowflake and gets the refresh token when the connection is opened.
    Role Specifies the role used in the session. If it is not specified, the default role of the user is used.
    Schema Specifies the default schema of the session. Unqualified object names in SQL statements refer to this schema.
    Text36AsGuid Determines whether VARCHAR(36) columns are returned as Guid values. The default value is false.
    Text38AsGuid Determines whether VARCHAR(38) columns are returned as Guid values. The default value is false.
    User Specifies the login name of the Snowflake user. Required for the Basic and KeyPair authentication methods.
    Warehouse Specifies the virtual warehouse that executes queries. If it is not specified, the default warehouse of the user is used.
    Connection Lifetime Determines the maximum time span (in seconds) a connection can remain in the pool: 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 exceeds the value specified by Connection Lifetime. The default value is 0 (connection always returns to pool).
    Connect Timeout -or- Connection Timeout Specifies 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 60.
    Default Command Timeout Specifies the time in seconds to wait while trying to execute a command before terminating the attempt and generating an error. A value of 0 indicates no limit. The default value is 3600.
    Initialization Command Specifies a data source-specific command to execute immediately after the connection is established.
    Max Pool Size Specifies 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.
    Min Pool Size Specifies the minimum number of connections allowed in the pool. The default value is 0.
    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 Determines whether, by default, the SnowflakeConnection object is drawn from the appropriate pool or is created and added to the appropriate pool, when set to true.
    Proxy Host Specifies the host name or IP address of proxy server.
    Proxy Password Specifies the password for the proxy server account.
    Proxy Port Specifies the port number of the proxy server. The default value is 3128.
    Proxy User Specifies the proxy server account name.
    Run Once Command Specifies a command to execute the first time the connection is opened. The command is not executed when the connection is retrieved from the connection pool.
    UTC Dates Indicates whether all the datetime values retrieved from the data source are returned as UTC values or converted to local time, and whether date values, specified on the application side (for example, in SQL statements) are considered UTC or local. Default value is false.
    Example
    The following example creates a SnowflakeConnection and sets some of its properties in the connection string.
    public void CreateSnowflakeConnection()
    {
      string myConnString1 = 
         "Domain=myorg-myaccount.snowflakecomputing.com;User=your_user;Password=********;Database=your_database;Schema=your_schema;Warehouse=your_warehouse;License Key=**********";
      SnowflakeConnection snowflakeConnection1 = new SnowflakeConnection(myConnString1);
      snowflakeConnection1.Open();
    }
    Public Sub CreateSnowflakeConnection()
      Dim myConnString1 As String = _
          "Domain=myorg-myaccount.snowflakecomputing.com;User=your_user;Password=********;Database=your_database;Schema=your_schema;Warehouse=your_warehouse;License Key=**********"
      Dim snowflakeConnection1 As New SnowflakeConnection(myConnString1)
      snowflakeConnection1.Open()
    End Sub
    See Also