I am trying to connect to Teradata with dotnet core driver: Teradata.Client.Provider 17.10.2.
I have set-up a Teradata Vantage Express instance and I am able to connect to it via DBeaver (JDBC) with default credentials dbc/dbc.
Based on docs and this answer https://stackoverflow.com/a/21267030/3120219 I'm now trying to connect via a C# driver with the following code:
using System;
using Teradata.Client.Provider;
using Xunit;
namespace MyProject.Test
{
public class TeradataConnectionTest
{
public void TestConnection()
{
var connectionStringBuilder = new TdConnectionStringBuilder
{
DataSource = "localhost",
Database = "dbc",
UserId = "dbc",
Password = "dbc",
AuthenticationMechanism = "TD2" // Tried also "LDAP" and "TDNEGO"
};
using TdConnection cn = new TdConnection();
cn.ConnectionString = connectionStringBuilder.ConnectionString;
cn.Open(); // exception here
TdCommand cmd = cn.CreateCommand();
cmd.CommandText = "SELECT DATE";
using (TdDataReader reader = cmd.ExecuteReader())
{
reader.Read();
DateTime date = reader.GetDate(0);
}
}
}
}
But I'm receiving this exception on connection open:
Teradata.Client.Provider.TdException
[.NET Data Provider for Teradata] [115057] The WebSocket handshake response is invalid. Details: Unexpected or invalid response received.
HTTP/1.1 302 Found
Cache-Control: public, no-store, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:
Strict-Transport-Security: max-age=15768000; includeSubDomains
Location: /login.html
Transfer-Encoding: chunked
Date: Tue, 01 Feb 2022 17:30:07 GMT
Server: Teradata-Viewpoint
It seems that the client is trying to connect to the webserver instead of the data provider services.
What am I missing ?