当我尝试使用Python连接Teradata时,显示“当前无法通过该网络访问Teradata服务器”

我一直在尝试使用python通过编程从Linux ec2计算机连接到Teradata(在本地服务器上)。但是程序因错误而失败。

以下是我使用的详细信息:

环境变量:

 export ODBCINI=/opt/teradata/client/16.20/odbc_64/odbc.ini
 export ODBCINST=/opt/teradata/client/16.20/odbc_64/odbcinst.ini
 export LD_libraRY_PATH=/opt/teradata/client/16.20/odbc_64/lib

odbcinst.ini

 [ODBC Drivers]
    Teradata Database ODBC Driver 16.20=Installed

    [Teradata Database ODBC Driver 16.20]
    Description=Teradata Database ODBC Driver 16.20
    Driver=/opt/teradata/client/16.20/odbc_64/lib/tdataodbc_sb64.so
    # Note: Currently,Data Direct Driver Manager does not support Connection Pooling feature.

odbc.ini

[ODBC]
# For Data Direct to load its error messages
# Data Direct Driver Manager looks for the messages here:
# "/opt/teradata/client/16.20/locale/xx_xx/LC_MESSAGES/"
InstallDir=/opt/teradata/client/16.20/odbc_64
Trace=no
Pooling=yes

[ODBC Data Sources]
Teradata ODBC Dsn=Teradata Database ODBC Driver 16.20

[Teradata ODBC Dsn]
# This key is not necessary and is only to give a description of the data source.
Description=Teradata Database ODBC Driver 16.20

# Driver: The location where the ODBC driver is installed to.
Driver=/opt/teradata/client/16.20/odbc_64/lib/tdataodbc_sb64.so

# Required: These values can also be specified in the connection string.
DBCName=
UID=
PWD=

# Optional
accountString=
CharacterSet=ASCII
DatasourceDNSEntries=
DateTimeFormat=AAA
DefaultDatabase=
DontUseHelpDatabase=0
DontUseTitles=1
EnableExtendedStmtInfo=1
EnableReadAhead=1
IgnoreODBCSearchPattern=0
LogErrorEvents=0
LoginTimeout=20
MaxRespSize=65536
MaxSingleLOBBytes=4000
MaxTotalLOBBytesPerRow=65536
MechanismName=
NoScan=0
PrintOption=N
retryOnEINTR=1
ReturnGeneratedKeys=N
Sessionmode=System Default
SplOption=Y
TABLEQUALIFIER=0
TCPNoDelay=1
TdmstPortNumber=1025
UPTMode=Not set
USE2XAPPCUSTOMCATALOGMODE=0
UseDataEncryption=0
UseDateDataForTimeStampParams=0
USEINTEGRATEDSECURITY=0
UseSequentialRetrievalOnly=0
UseXViews=0
EnableUDFUpload=0
UDFUploadPath=Please enter the UDF folder path

以下是用于连接到Teradata的Python代码:

import teradata
udaExec=teradata.UdaExec(odbcLibPath="/opt/teradata/client/16.20/odbc_64/lib/libodbc.so",appName="testconnec",version="1.0",logConsole=False)
session = udaExec.connect(method="odbc",system="TeraDev",username="myusername",password="mypassword",driver="Teradata Database ODBC Driver 16.20");

执行后出错

teradata.api.DatabaseError: (439,u"[08001] [Teradata][WSock32 DLL] (439) WSA E HostUnreach: The Teradata server can't currently be reached over this network")

我在这里想念什么?

wsetty 回答:当我尝试使用Python连接Teradata时,显示“当前无法通过该网络访问Teradata服务器”

我遇到了同样的问题,我运行“ pdestate -a”,结果是“ PDESTATE HARDSTOP / DOWN”。意味着数据库服务未启动并正在运行。我再次输入“ /etc/init.d/tpa start”,然后输入“ /etc/init.d/tgtw start”,然后再次输入“ pdestate -a”,这次的结果是“ PDESTATE RUN / STARTED”。

Tldr;在尝试通过脚本连接数据库服务之前,先启动数据库服务。

本文链接:https://www.f2er.com/3108405.html

大家都在问