我一直在尝试使用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")
我在这里想念什么?