【发布时间】:2020-07-13 00:30:44
【问题描述】:
我正在尝试使用 Python 中的 teradatasql 模块连接到 Teradata。该代码在 localhost 上运行良好,但一旦作为服务器代码的一部分部署到服务器上,就会引发错误。
代码:
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)
我在服务器上遇到错误:
[版本 16.20.0.60] [会话 0] [Teradata SQL 驱动程序] 在 gosqldriver/teradatasql 接收配置响应消息头↵失败。 (*teradataConnection).makeDriverError TeradataConnection.go:1101↵ 在 gosqldriver/teradatasql。 (*teradataConnection).sendAndReceive TeradataConnection.go:1397↵ 在 gosqldriver/teradatasql.newTeradataConnection TeradataConnection.go:180↵ 在 gosqldriver/teradatasql.(*teradataDriver)。 打开 TeradataDriver.go:32↵ 在 database/sql.dsnConnector.Connect sql.go:600↵ 在 database/sql.(*DB).conn sql.go:1103↵ 在 database/sql。 (*DB).Conn sql.go:1619↵ 在 main.goCreateConnection goside.go:275↵ 在 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↵ goexit asm_amd64.s:2361↵read tcp IP:PORT->IP:PORT: wsarecv: 一个现有的连接被远程主机强行关闭
【问题讨论】:
-
听起来像是连接问题 - 错误的 IP 地址、端口被阻止等。
-
是的。在登录对话的早期,有东西关闭了连接(发送了 TCP RST)。
-
我经常看到这个错误,即使我可以 ping 服务器并连接到 Teradata Studio。我在我的 WIndows 机器上得到了这个,它还涉及一个 VPN 连接,使这个更难隔离。相同的代码在同一网络上的 linux 机器上运行良好。