Send feedback on this topic.
Teradata.Client.Provider
ChangeDatabase Method



Teradata.Client.Provider Namespace > TdConnection Class : ChangeDatabase Method
The default database name
Changes the default database associated with this Teradata connection.
Syntax
'Declaration
 
Public Overrides NotOverridable Sub ChangeDatabase( _
   ByVal databaseName As String _
) 
'Usage
 
Dim instance As TdConnection
Dim databaseName As String
 
instance.ChangeDatabase(databaseName)
public override void ChangeDatabase( 
   string databaseName
)
public:
void ChangeDatabase( 
   String^ databaseName
) override 

Parameters

databaseName
The default database name
Exceptions
ExceptionDescription
Input parameter value is invalid. See remarks.
TdConnection is not in the open state.
Teradata returned an error.
Remarks
The Data Provider generates and executes a DATABASE command (See Teradata documentation) when the connection is in the open state. An ArgumentException is thrown if the input parameter value is either null, an empty string or made up of all space characters.

Note that if a transaction (TdTransaction) is active, you are required to commit the transaction after the ChangeDatabase method returns control back to the application. Otherwise Teradata will return a 3932 error code. This error code indicates a DDL statement is required to be the last statement within an explicit transaction.

The default Command timeout (TdCommand.CommandTimeout) is used to execute the DATABASE command. The Data Provider will throw an exception ("[100038] Command did not complete within the time specified (timeout).") when the Advanced SQL Engine delays the execution of this command more than the default Command timeout. The Connection-String CommandTimeout attribute (TdConnectionStringBuilder.CommandTimeout) should be used to increase the default Command timeout.

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