Send feedback on this topic.
Teradata.Client.Provider
ConnectionString Property
Example 



Teradata.Client.Provider Namespace > TdConnection Class : ConnectionString Property
Gets or sets the string used to open a connection to Teradata. The ConnectionString identifies session attributes like User Id, Password, Data Source etc.
Syntax
'Declaration
 
Public Overrides NotOverridable Property ConnectionString As String
'Usage
 
Dim instance As TdConnection
Dim value As String
 
instance.ConnectionString = value
 
value = instance.ConnectionString
public override string ConnectionString {get; set;}
public:
property String^ ConnectionString {
   String^ get() override;
   void set (    String^ value) override;
}

Property Value

Value is a string representing the attributes (e.g. Teradata server name, User Id, and Password) used to open a connection to Teradata. The default value is an empty string.
Exceptions
ExceptionDescription
An invalid connection string is entered.
TdConnection is already in the open state.
Remarks
ConnectionString property is used to set specific Teradata session attributes. The required format for the ConnectionString is: Attribute=Value;Attribute=Value;....

An example of a typical valid connection string is: Data Source=Teradata1; User Id=myName;Password=myPassword;

The attribute name is separated from the value with an equal sign. A semicolon is used to separate Attribute-Value pairs. The value is required to be enclosed in double quotes (i.e. ") or single quotes when containing a leading space, an equal sign, a leading double quote, a leading single quote, a semicolon or trailing space. These are all valid characters for the value. The value should be enclosed in single quotes when containing leading double quotes or conversely it should be enclosed in double quotes when containing leading single quotes. The delimiting character (single or double quote) must be doubled every time it occurs within the value.

For example given a password "my'pass containing special characters " and '.

Applying the above rules to the password will result in '"my''pass' .

We recommend using TdConnectionStringBuilder as it applies all the rules mentioned above.

An ArgumentException exception is thrown when an error in the connection string is detected. For example, an exception is thrown if an invalid attribute is specified.

The following table lists all the valid attributes and the corresponding acceptable values:
Attribute / Values / Default Value Description
Account String

Values - 1 to 30 characters String

Default Value - Empty String

Please see TdConnectionStringBuilder.AccountString
Authentication Mechanism

Values - 1 to 8 characters String

Default Value - Please see the Teradata Security Administration User Manual discussion on the Generic Security Services Library (TDGSS) - Managing Network Security

Please see TdConnectionStringBuilder.AuthenticationMechanism
Authentication String

Values - String

Default Value - Empty String

Please see TdConnectionStringBuilder.AuthenticationString
Command Timeout

Values - integer

Default Value - 30 seconds

Please see TdConnectionStringBuilder.CommandTimeout
Connection Pooling

Values - True or False

Default Value - True

Please see TdConnectionStringBuilder.ConnectionPooling
Connection Pooling Timeout

Values - integer

Default Value - 60 seconds

Please see TdConnectionStringBuilder.ConnectionPoolingTimeout
Connection Timeout

Values - integer

Default Value - 20 seconds

Please see TdConnectionStringBuilder.ConnectionTimeout
Connect Max Retry Count

Values - Int32

Default Value - 200

Please see TdConnectionStringBuilder.ConnectMaxRetryCount
Database

Values - String

Default Value - empty string

Please see TdConnectionStringBuilder.Database
Data Encryption

Values - Boolean

Default Value - false

Please see TdConnectionStringBuilder.DataEncryption
Data Integrity

Values - Boolean

Default Value - false

Please see TdConnectionStringBuilder.DataIntegrity
Data Source

Values - String

Default Value - Empty String

Please see TdConnectionStringBuilder.DataSource
Data Source Dns Entries

Values - integer

Default Value - undefined

Please see TdConnectionStringBuilder.DataSourceDnsEntries
Enable DateTimeOffset

Values - Boolean

Default Values - true

Please see TdConnectionStringBuilder.EnableDateTimeOffset
Enable TdDateTime

Values - Boolean

Default Value - true

Please see TdConnectionStringBuilder.EnableTdDateTime
Enable TdDecimal

Values - Boolean

Default Value - true

Please see TdConnectionStringBuilder.EnableTdDecimal
Integated Security

Values - Boolean

Default Value - false

Please see TdConnectionStringBuilder.IntegratedSecurity
Max Decimal Precision

Values - integer

Default Value - 38

Please see TdConnectionStringBuilder.MaxDecimalPrecision
Max Pool Size

Values - integer

Default Value - 100

Please see TdConnectionStringBuilder.MaxPoolSize
Min Pool Size

Values - integer

Default Value - 0

Please see TdConnectionStringBuilder.MinPoolSize
New Password

Values - String

Default Value - empty string

Please see TdConnectionStringBuilder.NewPassword
Node Down Timeout

Values - integer

Default Value - 90 seconds

Please see TdConnectionStringBuilder.NodeDownTimeout
Password

Values - String

Default Value - empty string

Please see TdConnectionStringBuilder.Password
Persist Security Info

Values - Y or N

Default Value - N

Please see TdConnectionStringBuilder.PersistSecurityInfo
Port Number

Values - 1 - 65,535

Default Value - 1025

Please see TdConnectionStringBuilder.PortNumber
Profile Name

Values - String

Default Value - empty string

Please see TdConnectionStringBuilder.ProfileName
Query Band

Values - Query Band definitions

Default Value - empty TdQueryBand instance

Please see TdConnectionStringBuilder.QueryBand
Read Ahead

Values - Boolean

Default Value - true

Please see TdConnectionStringBuilder.ReadAhead
Recovery

Values - 1) DEFAULT 2) RNP 3) REDRIVE 4) OFF

Default Value - DEFAULT

Please see TdConnectionStringBuilder.Recovery
Recovery Command Timeout Override

Values - Boolean

Default Value - true

Please see TdConnectionStringBuilder.RecoveryCommandTimeoutOverride
Recovery Interval Factor

Values - Int32

Default Value - 2

Please see TdConnectionStringBuilder.RecoveryIntervalFactor
Recovery Maximum Interval

Values - Int32

Default Value - 32 seconds

Please see TdConnectionStringBuilder.RecoveryMaximumInterval
Recovery Start Interval

Values - Int32

Default Value - 2 seconds

Please see TdConnectionStringBuilder.RecoveryStartInterval
Recovery Timeout

Values - Int32

Default Value - 1200 seconds

Please see TdConnectionStringBuilder.RecoveryTimeout
Response Buffer Size

Values - 400 to 1000000

Default Value - 64000

Please see TdConnectionStringBuilder.ResponseBufferSize
Restrict to Default Database

Values - Boolean

Default Value - false

Please see TdConnectionStringBuilder.RestrictToDefaultDatabase
Session Character Set

Values - 1) ASCII 2) KANJISJIS_0S (see note below) 3) UTF16 or 4) UTF8

Default Value - ASCII

Note: (0 is zero, not letter O)

Please see TdConnectionStringBuilder.SessionCharacterSet
Session Mode

Values - 1) ANSI 2) TERADATA or 3) DEFAULT

Default Value - DEFAULT

Please see TdConnectionStringBuilder.SessionMode
Use Enhanced Schema Table

Values - Boolean

Default Value - true

Please see TdConnectionStringBuilder.UseEnhancedSchemaTable
User ID

Values - String

Default Value - empty string

Please see TdConnectionStringBuilder.UserId
Use XViews

Values - Boolean

Default Value - true

Please see TdConnectionStringBuilder.UseXViews

Example
The following example creates an instance of TdConnection class, sets the TdConnection.ConnectionTimeout property and opens the connection to the Advanced SQL Engine.
public TdConnection CreateTdConnection()
{
    TdConnection cn = new TdConnection();
            
    cn.ConnectionString = “Data Source=Teradata1;User Id=ca;Password=ca;”;
            
    cn.ConnectionTimeout = 30;
            
    cn.Open();
            
    return cn;
}
Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdConnection Class
TdConnection Members