Send feedback on this topic.
Open Method

Teradata.Client.Provider Namespace > TdConnection Class : Open Method
Opens a Teradata session using the attributes specified via the TdConnection.ConnectionString.
Public Overrides NotOverridable Sub Open() 
Dim instance As TdConnection
public override void Open()
void Open(); override 
The TdConnection is disposed.
TdConnection is not in the Closed state.
The Teradata Database returned an error or the .NET Data Provider for Teradata returned an error.

If connection pooling is turned off, TdConnection attempts to establish a new Teradata session. Otherwise, the ConnectionPool either returns an existing Teradata Session or creates a new Teradata session if the number of pooled sessions is less than Max Pooled Size.

If the connection string has a Database attribute, the TdConnection.ChangeDatabase method is called immediately after a session is opened to Teradata. This will result in additional roundtrips to the Teradata Database. We strongly recommend that you modify the User (See Teradata manual for information on Create User or Alter User) and add a default database. This will enhance the overall performance of opening a connection to the Teradata Database. Please note that ChangeDatabase method is called independently of whether the connection pooling is turned on or off and errors generated as a result of an invalid supplied ConnectionString Database attribute are ignored.

If the password has expired and pooling is turned off, then an TdConnection.InfoMessage event is triggered. The application should respond to the event by:

1) Change the password
2) Close the TdConnection
3) Open the TdConnection

Alternatively, the application can set the ‘New Password’ attribute in the connection string.

The following example creates a TdConnection class and illustrates the use of Open and Close methods.
public Boolean TestConnectivity(String connectionString)
   Boolean connectivity = false;
   TdConnection cn = new  TdConnection(connectionString);
      connectivity = true;
   catch(Exception e)
      connectivity = false;
   return connectivity;

Target Platforms: Windows 7, Windows 8, Windows 8.1, Windows 10, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2

See Also


TdConnection Class
TdConnection Members