Search code examples
jdbcamazon-athena

JDBC AWS - Athena - Specify Database


I am trying to use Athena with JDBC to execute some SQL queries. I've read a lot how to connect:

"jdbc:awsathena://AwsRegion=us-east-1;User=%s;Password=%s;S3OutputLocation=%s"

Above is simple example, but how to specify which database I'll connect or execute queries.

When I use this url I catch this error:

Exception in thread "main" java.sql.SQLException: [Simba][AthenaJDBC](100071) An error has been thrown from the AWS Athena client. TABLE_NOT_FOUND: line 1:15: Table 'awsdatacatalog.default.fc_content' does not exist

This table was created in another database and datasource.


Solution

  • Page 100 of the manual you can see how to select the Catalog at connection time.

    You can also use fully qualified table names in your queries as an alternative.