Connect to Vantage using JDBC

Author: Adam Tworkiewicz
Last updated: November 14th, 2022

Overview

This how-to demonstrates how to connect to Teradata Vantage using JDBC using a sample Java application: https://github.com/Teradata/jdbc-sample-app.

Prerequisites

  • Access to a Teradata Vantage instance.

    If you need a new instance of Vantage, you can install a free version called Vantage Express in the cloud on Google Cloud, Azure, and AWS. You can also run Vantage Express on your local machine using VMware, VirtualBox, or UTM.
  • JDK

  • Maven

Add dependency to your maven project

Add the Teradata JDBC driver as a dependency to your Maven POM XML file:

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:

Run the tests

Run the tests:

mvn test

Summary

This how-to demonstrated how to connect to Teradata Vantage using JDBC. It described a sample Java application with Maven as the build tool that uses the Teradata JDBC driver to send SQL queries to Teradata Vantage.

Did this page help?