Open FrankWangAU opened 6 years ago
Hi Frank,
I have not tested PyTd on AIX. You can set odbcLibPath without a code change by passing it as an argument to UdaExec or by specifying it in an external config file. I think we would only add the default value for AIX if it was officially tested on that platform. I will keep this issue open to track interest in officially certifying on AIX.
Thanks, -Eric
Hi Eric,
Did not know that we can specify "odbcLibPath" in external config file. I think I will go with this solution for now.
Thanks for your help.
Regards, Frank
Hi Frank and Eric,
Glad to find this discussion, as I've also struggled to connect to Python to Teradata from AIX 7.1. Defining the odbcLibPath was critical, but I found it only works when placed in the udaexec.ini and NOT when passed as a UdaExec parameter.
I also found (in another post) that I had to define Authentication=LDAP. Strangely, this only works as a UdaExec parameter but NOT in the udaexec.ini (converse to the odbcLibPath)! Beyond the finicky location, this confuses me for other reasons... first, because the Teradata Python Module documentation doesn't include Authentication among UdaExec's valid parms, but also because I had already declared "Authentication=LDAP" in the odbc.ini config, within my DSN section. Why doesn't it work there?
Here is my sample Python program (which works):
import teradata udaExec = teradata.UdaExec(appName="Test1", version="1.0") with udaExec.connect(method="odbc", authentication="LDAP", system="tdt", username="xxx", password="$$tdwallet(xxx)") as myses: ...
My udaexec.ini file: `[CONFIG] logConsole=True
[DEFAULT] odbcLibPath=/opt/teradata/client/ODBC_64/lib/odbc.so `
And finally, my /opt/teradata/client/ODBC_64/odbc.ini file: `[ODBC] InstallDir=/opt/teradata/client/ODBC_64 Trace=0 TraceDll=/opt/teradata/client/ODBC_64/lib/odbctrac.so TraceFile=/usr/joe/odbcusr/trace.log TraceAutoStop=0
[ODBC Data Sources] tdt=tdata.so
[tdt] Driver=/opt/teradata/client/ODBC_64/lib/tdata.so Description=Teradata Test database DBCName=tdt Authentication=LDAP Charset=UTF16`
Optimally, I want to place as much config as possible in external files to keep our programs cleaner, so I'd like to move the "method" and "authentication" to external configs, but attempting to do so breaks the db connection. Any insight you can offer is appreciated.
Thanks, Dan
Hi @djb18
I never use ODBC DSN as 'system', I always put all parameters into a external config file. you need ensure ODBC driver info in file: /opt/teradata/client/ODBC_64/odbcinst.ini is correct.
Frank
Hi Guys,
I am stuck on the same issue here - I tried to pass an alternative value of odbcLibPath, but in both cases (in config, and passing as a param), I get the same error:
using: odbcLibPath=/opt/teradata/client/ODBC_64/lib/odbc.
File "/opt/freeware/lib64/python3.5/teradata/udaexec.py", line 183, in connect **args)) TypeError: type object got multiple values for keyword argument 'odbcLibPath'
Any assistance gratefully received. Soberoo
Env: OS AIX 7.1.0.0 tdodbc version: 14.10.0.7 xxxxxxxxxx:/opt/teradata/client/ODBC_64/lib: lslpp -l | grep odbc tdodbc1410.tdodbc1410 14.10.0.7 COMMITTED Teradata ODBC Driver for AIX
Tried to use PyTD to connect Teradata in AIX 7.1 but got following error: Traceback (most recent call last): File "/opt/freeware/lib64/python3.5/runpy.py", line 184, in _run_module_as_main "main", mod_spec) File "/opt/freeware/lib64/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/xxxxxx/python/proj/cba/aipl/proj_teradata.py", line 71, in
with ConnTest() as myConnTest:
File "/home/xxxxxx/python/proj/cba/aipl/teradata/proj/init.py", line 1747, in init
self.session = get_db_conn(config_files, query_band)
File "/home/xxxxxx/python/proj/cba/aipl/teradata/utils/tdconn.py", line 166, in get_db_conn
session = uda_exec.connect(queryBands=query_band, dataTypeConverter=TeradataDataTypeConverter(), conn_param)
File "/home/xxxxxx/python/proj/lib64/python3.5/site-packages/teradata/udaexec.py", line 183, in connect
args))
File "/home/xxxxxx/python/proj/lib64/python3.5/site-packages/teradata/tdodbc.py", line 399, in init
init(odbcLibPath)
File "/home/xxxxxx/python/proj/lib64/python3.5/site-packages/teradata/tdodbc.py", line 344, in init
initOdbcLibrary(odbcLibPath)
File "/home/xxxxxx/python/proj/lib64/python3.5/site-packages/teradata/tdodbc.py", line 297, in initOdbcLibrary
odbc = ctypes.cdll.LoadLibrary(odbcLibPath)
File "/opt/freeware/lib64/python3.5/ctypes/init.py", line 435, in LoadLibrary
return self._dlltype(name)
File "/opt/freeware/lib64/python3.5/ctypes/init.py", line 357, in init
self._handle = _dlopen(self._name, mode)
OSError: 0509-022 Cannot load module .
0509-026 System error: A file or directory in the path name does not exist.
Did a little bit further investigation, then found there was an issue to load libodbc.so
It turned out there is no file named libodbc.so, but there is one file named "odbc.so" exist in /opt/teradata/client/ODBC_64/lib
So, I manually changed the code of function: initOdbcLibrary in tdodbc.py and added hack for AIX, now it is working fine.
workaround codes:
Should this workaround to be added in? Do we have testing in AIX flatform?
Thanks, Frank