Connect to Athena Tables from Java Spring

Amazon Athena is an interactive query service that allows you to use standard SQL to view and analyze data in your organization's Tetra Data Lake S3 bucket. This page describes how to connect to your Athena tables from the Java Spring third-party tool.

Before You Begin

Before you can use Java Spring as a third-party tool to connect to Athena tables, you must have:

Connect to Athena Tables from Java Spring

To connect to Athena tables from Java Spring, you must configure a data source. After you configure the data source, you can use it with the jdbcTemplate as any other JDBC data source.

Example of a Java Spring configuration:

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

import javax.sql.DataSource;
import java.util.Properties;

public class ApplicationConfig {
    private Environment env;

    public DataSource dataSource(){
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        // Without this property, Athena will not work
        Properties props = new Properties();

        return dataSource;