Use Teradata with ODBC on Ubuntu
Overview
This how-to demonstrates how to use the ODBC driver with Teradata on Ubuntu.
Prerequisites
- Access to a Teradata instance.
Note
If you need a test instance of Teradata, you can provision one for free at https://www.teradata.com/try
- Root access to an Ubuntu machine. If you don't have a local Ubuntu machine, you can use an AWS EC2 instance as described in the steps below.
- An AWS account (if using EC2).
Installation
Option 1: Launch an Ubuntu instance on AWS EC2
If you don't have a local Ubuntu machine, follow these steps to launch one on AWS EC2:
- Go to the AWS EC2 Console and click Launch Instance.
- Enter a name for your instance.
- Under Application and OS Images, select Ubuntu and choose Ubuntu Server 22.04 LTS as the AMI.
- Under Instance type, select
t2.microort3.micro. - Under Key pair, click Create new key pair. Name it, keep the defaults (RSA, .pem), and click Create key pair. The
.pemfile will download automatically — save it to~/.ssh/. - Under Network settings, ensure Allow SSH traffic is checked and set the source to My IP.
- Click Launch Instance.
- Once the instance is running, copy the Public IPv4 address from the instance details page.
- Set permissions on your key file and connect via SSH:
- Once connected, get root access:
Install dependencies
Install Teradata ODBC driver
Download the Teradata ODBC driver for Linux from the Teradata Downloads page. A Teradata account is required to download the driver. Download the file tdodbc2000__linux_x8664.20.00.00.66-1.tar.gz to your local machine.
If you are using an AWS EC2 instance, open a new terminal window on your local machine and use scp to transfer the file:
Back in your SSH session, extract and convert the driver package to a Debian-compatible format, then install it:
Configure ODBC
Create the file /etc/odbcinst.ini with the following content:
Use ODBC
Install pyodbc:
Create a test.py file with the following content. Replace DBCName, UID and PWD with your Teradata instance hostname, username and password:
Run the test application:
You should get output similar to:
Summary
This how-to demonstrated how to use ODBC with Teradata 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.