5

I am trying to connect to Teradata using teradatasql module in Python. The code is running fine on localhost, but once deployed on the server as part of the server code, it is throwing the error.

the code:

import teradatasql
try:
    host, username, password = 'hostname', 'username', '****'
    session = teradatasql.connect(host=host, user=username, password=password, logmech="LDAP")

except Exception as e:
    print(e)

Error I am getting on server:

[Version 16.20.0.60] [Session 0] [Teradata SQL Driver] Failure receiving Config Response message header↵ at gosqldriver/teradatasql. (*teradataConnection).makeDriverError TeradataConnection.go:1101↵ at gosqldriver/teradatasql. (*teradataConnection).sendAndReceive TeradataConnection.go:1397↵ at gosqldriver/teradatasql.newTeradataConnection TeradataConnection.go:180↵ at gosqldriver/teradatasql.(*teradataDriver). Open TeradataDriver.go:32↵ at database/sql.dsnConnector.Connect sql.go:600↵ at database/sql.(*DB).conn sql.go:1103↵ at database/sql. (*DB).Conn sql.go:1619↵ at main.goCreateConnection goside.go:275↵ at main. _cgoexpwrap_212fad278f55_goCreateConnection _cgo_gotypes.go:240↵ at runtime.call64 asm_amd64.s:574↵ at runtime.cgocallbackg1 cgocall.go:316↵ at runtime.cgocallbackg cgocall.go:194↵ at runtime.cgocallback_gofunc asm_amd64.s:826↵ at runtime.goexit asm_amd64.s:2361↵Caused by read tcp IP:PORT->IP:PORT: wsarecv: An existing connection was forcibly closed by the remote host

James Z
  • 12,209
  • 10
  • 24
  • 44
Kritz
  • 89
  • 2
  • 13
  • Sounds like a connectivity issue - wrong ip address, port is blocked, something like that. – Andrew Apr 01 '20 at 13:43
  • Yes. Something closed the connection (sent TCP RST) early in the login conversation. – Fred Apr 01 '20 at 22:30
  • I regularly see this error, even when I can ping the server and connect with Teradata Studio. I get this on my WIndows machine, which also involves a VPN connection to make this harder to isolate. The same code works fine from a linux box on the same network. – dsz Nov 14 '20 at 01:03

1 Answers1

1

The root cause of this error is outlined here by tomnolan:

The stack trace indicates that a TCP socket connection was made to the database, then the driver transmitted a Config Request message to the database, then the driver timed out waiting for a Config Response message from the database.

In other words, the driver thought that it had established a TCP socket connection, but the TCP socket connection was probably not fully successful, because a failure occurred on the initial message handshake between the driver and the database.

The most likely cause is that some kind of networking problem prevented the driver from properly connecting to the database.

I had this issue today and resolved it by altering my host. I am also on a VPN and found that the actual host name in DNS didn't work, but the ALIAS available did. For example on Windows:

C:\WINDOWS\system32>nslookup MYDB-TEST # <-- works
Server:  abcd.domain.com
Address: <OMITTED>
Name:    MYDB.domain.com # <-- doesn't work
Address:  <OMITTED>
Aliases:  mydb-test.domain.com # <-- works

I recognize this may be a specific solution option that may not work for everyone, but the root of the problem is confirmed to be a TCP connection issue from my experience.

Tyler Seader
  • 156
  • 1
  • 4