0

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 ?

Claudio
  • 3,060
  • 10
  • 17
  • What are you passing for mechanism? Try with `TD2`. – Fred Feb 02 '22 at 01:28
  • I've tried all available values. `TD2` of course was the first, but I tried also other values. Same results for TD2, TDNEGO, LDAP. – Claudio Feb 02 '22 at 07:02
  • 1
    Perhaps the 17.10 .Net provider's new default TLS1.2 connection strategy isn't compatible with the TD Express instance configuration. Try setting SslMode=Disable in the connection string. – Fred Feb 02 '22 at 15:18
  • Thank you! I have solved setting SslMode=Disable – Claudio Feb 03 '22 at 08:10
  • Great! On a full Teradata system the default SslMode=Prefer should be OK, because the Viewpoint web portal would be running on a separate server/VM rather than on a database node. – Fred Feb 03 '22 at 15:24

0 Answers0