Skip to content

How to connect to Timeserie database using JDBC?

0

I'm using the free version of DBeaver. So no driver for AWS Timestream is included.

I downloaded the jdbc driver from AWS doc (Here: https://github.com/awslabs/amazon-timestream-driver-jdbc/releases )

Then I need to compose the jdbc connection string

Here: https://docs.aws.amazon.com/timestream/latest/developerguide/JDBC.url-examples.html I cannot see a single example starting from what i have in my aws console in the Timestream db page

I've only the ARN. How can I compose jdbc string for my Timestream db!?

asked 2 years ago616 views

2 Answers
0

To connect to an AWS Timestream database using JDBC in DBeaver, you need to follow these steps:

1. Download and Install the JDBC Driver:

2. Add the JDBC Driver to DBeaver:

  • Open DBeaver.
  • Go to Database > Driver Manager.
  • Click on New to create a new driver.
  • In the Driver Name field, enter a name for the driver (e.g., AWS Timestream).
  • Click on Add File and navigate to the location where you downloaded the JDBC driver. Select the driver JAR file.
  • In the Class Name field, enter the driver class name software.amazon.timestream.jdbc.TimestreamDriver.
  • Click OK to save the driver.

3. Compose the JDBC Connection String:

  • The JDBC URL for AWS Timestream should be composed based on the Timestream endpoint and the database name.
  • The basic format of the JDBC URL is:
jdbc:timestream://Region.amazonaws.com/DATABASE_NAME
  • You need to replace Region with your AWS region and DATABASE_NAME with the name of your Timestream database.

Example:

jdbc:timestream://us-east-1.amazonaws.com/MyTimestreamDB

4. Set Up the Connection in DBeaver:

  • Go to Database > New Database Connection.
  • Select the driver you created (e.g., AWS Timestream).
  • In the Main tab, enter the JDBC URL you composed in the previous step.
  • For the User name and Password, use your AWS IAM credentials or configure a specific IAM role with the necessary permissions for Timestream.

5. Advanced Configuration (Optional):

  • If you use IAM roles or profiles, you might need to configure AWS credentials provider chains.
  • You can add additional parameters in the JDBC URL for authentication and connection properties as per your needs.

Here is a more detailed example with IAM credentials:

Example JDBC URL

jdbc:timestream://us-east-1.amazonaws.com/MyTimestreamDB

Example Connection Configuration

  • Driver Class Name: software.amazon.timestream.jdbc.TimestreamDriver
  • JDBC URL: jdbc:timestream://us-east-1.amazonaws.com/MyTimestreamDB
  • User Name: YourIAMUser
  • Password: YourIAMUserPassword

Additional Parameters (Optional)

You can add parameters like aws_access_key_id, aws_secret_access_key, and aws_session_token for using temporary credentials:

jdbc:timestream://us-east-1.amazonaws.com/MyTimestreamDB?aws_access_key_id=YOUR_ACCESS_KEY&aws_secret_access_key=YOUR_SECRET_KEY&aws_session_token=YOUR_SESSION_TOKEN

Complete Example

Here is a complete example including IAM credentials:

jdbc:timestream://us-east-1.amazonaws.com/MyTimestreamDB?aws_access_key_id=AKIAIOSFODNN7EXAMPLE&aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY&aws_session_token=AQoDYXdzEPT...<remainder of security token>

Summary

  1. Add the downloaded JDBC driver to DBeaver.
  2. Compose the JDBC connection string using the format jdbc:timestream://Region.amazonaws.com/DATABASE_NAME.
  3. Configure the connection in DBeaver with the necessary authentication details.
  4. Connect to your Timestream database and start querying your time-series data.

By following these steps, you should be able to connect to your AWS Timestream database using DBeaver and the JDBC driver.

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

  • Actually I can connect using syntax jdbc:timestream://eu-central-1.amazonaws.com?database=here-my-database-name, but not using jdbc:timestream://eu-central-1.amazonaws.com/here-my-database-name. Also, I cannot see no one of the table inside the db.

0

Actually I can connect using syntax

jdbc:timestream://eu-central-1.amazonaws.com?database=here-my-database-name

but not using

jdbc:timestream://eu-central-1.amazonaws.com/here-my-database-name

Please note: using first syntax, I can enter every word and connection still works, even if DB doesn't exists

Also, I cannot see none of the table inside the db.

Also, I discovered the need to DO NOT use username and password but to add the following to driver properties

  • AccessKeyId
  • SecretAccessKey

Anyway, I cannot see tables inside the db. And I can see in AWS Console there is one table. But I cannot see the table in DBeaver. My user is a IAM user with Admin accesss to everything and with allow * to all the universe

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.