How to resolve pythonodbc issue with Teradata in Ubuntu -


i getting non text error pythonodbc in teradata ubuntu

`saranya@saranya-xps-8500:~/desktop$ python test.py` 

traceback (most recent call last): file "test.py", line 3, in conn=pyodbc.connect('driver={teradata};dbcname=...**;uid=*****;pwd=*****;', ansi=true, autocommit=true)

pyodbc.error: ('632', '[632] 523 630 (0) (sqldriverconnect)')

the solution provided in post pyodbc issue teradata not helping.

also, exporting odbcini, nlspath, ld_library_home,odbc_home values not helping either.

any appreciated

i saw obscure response, seems related number of problems while setting connection. working on linux box, able work setting dsn. this, create file in home directory ~/.odbc.ini similar following:

[odbc]  installdir=/opt/teradata/client/15.10 trace=0 tracedll=/opt/teradata/client/15.10/lib64/odbctrac.so tracefile={trace location, ie. /home/yourusername/odbctrace/trace.log} traceautostop=0  [odbc data sources] testdsn=tdata.so  [testdsn] driver=/opt/teradata/client/15.10/lib64/tdata.so description=teradata database dbcname={ip address of database} lastuser= username={your database's username} password={your database's password} database={database use} defaultdatabase={default database use} 

note: have fill out above {xxx} values. i've used default library installation values teradata odbc drivers on linux.

now, dsn file set up, set environment variable

export odbcini=/home/yourusername/.odbc.ini 

then should able run script

import pyodbc pyodbc.pooling = false conn = pyodbc.connect('dsn=testdsn') 

even better, if connecting teradata, install python teradata module with:

sudo pip install teradata 

once installed, can create connections following script

import teradata datetime import *  udaexec = teradata.udaexec(appname="generic name" +      datetime.now().strftime("%y_%m_%d:%h:%m:%s"), version="1.0",      configurelogging = true, logconsole=true) session = udaexec.connect(method="odbc", dsn="testdsn") 

by setting configurelogging=true , logconsole=true options, can output additional debugging information.

this @ least worked me!

erroneous errors

at time of writing, teradata odbc drivers in python output erroneous error messages. if drop table exists, says:

error:  (3807, u"[42s02] [teradata][odbc teradata driver][teradata database] object 'database.table_name' not exist. ") 

and if create table not exist, says:

error:  (3803, u"[42s01] [teradata][odbc teradata driver][teradata database] table 'database.table_name' exists. ") 

Comments