Connect to Vantage using JDBC

Author: Adam Tworkiewicz
Last updated: September 8th, 2021

Overview

This quick start demonstrates how to connect to Teradata Vantage using JDBC. We will go through a sample JDBC project. The entire project is published in GitHub at https://github.com/Teradata/jdbc-sample-app.

Prerequsites

Install the driver

  1. Go to the Teradata JDBC download page and download the driver (you can choose zip or tar). The website will ask you to login (if you don’t have an account you will need to register first) and accept the license before you download the file.

  2. Unzip the driver.

  3. Add the driver to your local Maven repository:

    mvn install:install-file \
       -Dfile=terajdbc4.jar \
       -DgroupId=com.teradata \
       -DartifactId=terajdbc4 \
       -Dversion=17.10.00.26 \
       -Dpackaging=jar \
       -DgeneratePom=true

Add dependency to your maven project

Now that we have the jar in the local repository, we can reference the jar as a dependency in our Maven pom:

Code to send a query

This step assumes that your Vantage database is available on localhost on port 1025. If you are running Vantage Express on your laptop, you need to expose the port from the VM to the host machine. Refer to your virtualization software documentation how to forward ports.

The project is set up. All that is left, is to load the driver, pass connection and authentication parameters and run a query:

Summary

In this quick start we have learned how to connect to Teradata Vantage using JDBC. We went through the process of installing the latest JDBC driver and later used it in a Java application with Maven as the build tool.

Did this page help?