Use Vantage with ODBC on Ubuntu
Author: Adam Tworkiewicz
Last updated: January 5th, 2022
Prerequisites
-
Access to a Teradata Vantage instance.
If you need a test instance of Vantage, you can provision one for free at https://clearscape.teradata.com. -
Root access to a Ubuntu machine.
Installation
-
Install dependencies:
apt update && DEBIAN_FRONTEND=noninteractive apt install -y wget unixodbc unixodbc-dev iodbc python3-pip
-
Install Teradata ODBC driver for Ubuntu:
wget https://downloads.teradata.com/download/cdn/connectivity/odbc/17.10.x.x/tdodbc1710__ubuntu_x8664.17.10.00.14-1.tar.gz \ && tar -xzf tdodbc1710__ubuntu_x8664.17.10.00.14-1.tar.gz \ && dpkg -i tdodbc1710/tdodbc1710-17.10.00.14-1.x86_64.deb
-
Configure ODBC, by creating file
/etc/odbcinst.ini
with the following content:[ODBC Drivers] Teradata Database ODBC Driver 17.10=Installed [Teradata Database ODBC Driver 17.10] Description=Teradata Database ODBC Driver 17.10 Driver=/opt/teradata/client/17.10/odbc_64/lib/tdataodbc_sb64.so
Use ODBC
We will validate the installation with a sample Python application. Create test.py
file with the following content.
Replace DBCName=192.168.86.33;UID=dbc;PWD=dbc
with the IP address of your Teradata Vantage instance, username and password:
import pyodbc
print(pyodbc.drivers())
cnxn = pyodbc.connect('DRIVER={Teradata Database ODBC Driver 17.10};DBCName=192.168.86.33;UID=dbc;PWD=dbc;')
cursor = cnxn.cursor()
cursor.execute("SELECT CURRENT_DATE")
for row in cursor.fetchall():
print(row)
EOF
Run the test application:
python3 test.py
You should get output similar to:
['ODBC Drivers', 'Teradata Database ODBC Driver 17.10'] (datetime.date(2022, 1, 5), )
Summary
This how-to demonstrated how to use ODBC with Teradata Vantage on Ubuntu. The how-to shows how to install the ODBC Teradata driver and the dependencies. It then shows how to configure ODBC and validate connectivity with a simple Python application.
Further reading
If you have any questions or need further assistance, please visit our community forum where you can get support and interact with other community members. |