Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Connecting Java and Dremio with ADBC

Instructions

This example uses Dremio, a data lakehouse platform that supports Arrow Flight SQL.

Tip

If you already have a Dremio instance running, skip the steps to set up Dremio.

Prerequisites

  1. Install Maven

  2. Install dbc

Set up Dremio

  1. Sign up for Dremio Cloud or follow the instructions to set up Dremio Community.

Connect to Dremio

  1. Install the Flight SQL ADBC driver:

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

    • Change the connection arguments in the params.put() calls
      • uri is the URI of your Dremio instance. The host and port will depend on your installation (the default port is 32010). The protocol scheme should be grpc or grpc+tcp if your Dremio instance is not using TLS (e.g. if you are using Dremio Community) and should be grpc+tls otherwise (e.g. when using Dremio Cloud).
      • username and password are the username and password of your Dremio account. (If you are using Dremio Community, these were set during the installation instructions.)
      • For Dremio Cloud, remove the existing uri, username, and password options, create a personal access token (PAT), store it in a String variable token in the program, and set the connection parameters as follows:
        params.put("uri", "grpc+tls://data.dremio.cloud:443"); // for US region
        // params.put("uri", "grpc+tls://data.eu.dremio.cloud:443"); // for Europe region
        params.put("adbc.flight.sql.authorization_header", "Bearer " + token);
    • If you changed uri to point to a different Flight SQL server, also change the SQL SELECT statement in stmt.setSqlQuery()
  3. Run the Java program:

    mvn compile exec:exec

    The output will look something like this:

    EXPR$0
    1.43624642310197