'Declaration Public Overrides NotOverridable Sub Open()
'Usage Dim instance As TdConnection instance.Open()
public override void Open()
public: void Open(); override
'Declaration Public Overrides NotOverridable Sub Open()
'Usage Dim instance As TdConnection instance.Open()
public override void Open()
public: void Open(); override
Exception | Description |
---|---|
System.ObjectDisposedException | The TdConnection is disposed. |
System.InvalidOperationException | TdConnection is not in the Closed state. |
TdException | The Advanced SQL Engine 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 Advanced SQL Engine. 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 Advanced SQL Engine. 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.
public Boolean TestConnectivity(String connectionString) { Boolean connectivity = false; TdConnection cn = new TdConnection(connectionString); try { cn.Open(); connectivity = true; } catch(Exception e) { connectivity = false; } cn.Close(); return connectivity; }
Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019