---
updatedAt: 2026-05-16T00:26:09.000Z
agentTools:
  projectIndex: https://developers.tetrascience.com/llms.txt
---

# Connect to Athena Tables from Java Spring

[llms-txt]: # "For AI agents: the complete documentation index is at https://developers.tetrascience.com/llms.txt — markdown versions of any page are available by appending .md to the URL."

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 do the following:

* [Download an Athena JDBC driver](https://developers.tetrascience.com/docs/use-third-party-tools-to-connect-to-athena-tables#what-driver-should-i-use)
* [Get SQL Credentials from the TDP](https://developers.tetrascience.com/docs/use-third-party-tools-to-connect-to-athena-tables#sql-credentials)

For more information about setting up the prerequisites, see [Use Third-Party Tools to Connect to Athena SQL Tables](https://developers.tetrascience.com/docs/use-third-party-tools-to-connect-to-athena-tables).

## 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:

```java ApplicationConfig.java
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;

@Configuration
public class ApplicationConfig {
    @Autowired
    private Environment env;

    @Bean
    public DataSource dataSource(){
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName("com.simba.athena.jdbc.Driver));
        dataSource.setUrl(env.getProperty("jdbc.url"));
        dataSource.setUsername(env.getProperty("jdbc.username"));
        dataSource.setPassword(env.getProperty("jdbc.password"));
        // Without this property, Athena will not work
        Properties props = new Properties();
        props.put("S3OutputLocation",env.getProperty("jdbc.S3OutputLocation"));
        props.put("WorkGroup",env.getProperty("jdbc.WorkGroup"));
        dataSource.setConnectionProperties(props);

        return dataSource;
    }
}
```

# Documentation Feedback

Do you have questions about our documentation or suggestions for how we can improve it? [Start a discussion in TetraConnect Hub](https://tetrascience.zendesk.com/hc/en-us/community/topics/38259263466893-Documentation-Feedback). For access, see [Access the TetraConnect Hub](https://developers.tetrascience.com/docs/access-the-tetrascience-knowledge-base).

> 📘 NOTE
>
> Feedback isn't part of the official TetraScience product documentation. TetraScience doesn't warrant or make any guarantees about the feedback provided, including its accuracy, relevance, or reliability. All feedback is subject to the terms set forth in the [TetraConnect Hub Community Guidelines](https://tetrascience.zendesk.com/hc/en-us/articles/26916126183309-TetraConnect-Hub-Community-Guidelines).