Skip to content

Latest commit

 

History

History
66 lines (44 loc) · 1.84 KB

File metadata and controls

66 lines (44 loc) · 1.84 KB

Connecting Java and Trino with ADBC

Instructions

Tip

If you already have a Trino instance running, skip the steps to run Trino in a Docker container.

Prerequisites

  1. Install Maven

  2. Install dbc

  3. Install Docker

Set up Trino

  1. Start Trino in a Docker container:

    docker run -d --name trino -p 8080:8080 trinodb/trino

Connect to Trino

  1. Install the Trino ADBC driver:

    dbc install trino
  2. Customize the main method in Example.java

    • Change the connection arguments in the params.put() calls
    • If you changed which Trino instance you're connecting to, also change the SQL SELECT statement in stmt.setSqlQuery()
  3. Run the Java program:

    mvn compile exec:exec

Clean up

  1. Stop and remove the Docker container running Trino:

    docker stop trino
    docker rm trino