Sunday, 15 March 2015

odbc - How to connect Teradata with Python in Linux? -



odbc - How to connect Teradata with Python in Linux? -

i trying connect td python in linux.

i got working on windows:

import pyodbc conn = pyodbc.connect('driver={teradata};dbcname=<host ip>;uid=<uid>;pwd=<uid>;quietmode=yes;') cursor = conn.cursor() sql = 'select * table_name' cursor.execute(sql) rows = cursor.fetchall() conn.close() print rows

steps followed on linux:

install pyodbc install teragss, tdicu, cliv2, piom, tdodbc run following: import pyodbc conn = pyodbc.connect('driver={teradata};dbcname=<host ip>;uid=<uid>;pwd=<uid>;quietmode=yes;')

pyodbc.error: ('im002', '[im002] [unixodbc][driver manager]data source name not found, , no default driver specified (0) (sqldriverconnect)')

am missing configuration step after installations?

environment:

python 2.6.6 (r266:84292, oct 12 2012, 14:23:48) [gcc 4.4.6 20120305 (red hat 4.4.6-4)] on linux2

the string pass driver needs a) name of driver in odbcinst.ini file or b) total path odbc driver shared object. using first method i'd suggest run odbcinst -j find out odbcinst.ini file , see if you've defined drivers. driver sections start [mydrivername] should have section starting [teradata] , should contain keyword/value pair of driver = /path/to/teradata/driver/shared_object. if have defined [teradata] driver check shared object pointed "driver" keyword exists, readable/executable , has no unresolved dependencies (run ldd on it).

python odbc teradata pyodbc unixodbc

No comments:

Post a Comment