Trino JDBC driver
Note
We will retire Azure HDInsight on AKS on January 31, 2025. Before January 31, 2025, you will need to migrate your workloads to Microsoft Fabric or an equivalent Azure product to avoid abrupt termination of your workloads. The remaining clusters on your subscription will be stopped and removed from the host.
Only basic support will be available until the retirement date.
Important
This feature is currently in preview. The Supplemental Terms of Use for Microsoft Azure Previews include more legal terms that apply to Azure features that are in beta, in preview, or otherwise not yet released into general availability. For information about this specific preview, see Azure HDInsight on AKS preview information. For questions or feature suggestions, please submit a request on AskHDInsight with the details and follow us for more updates on Azure HDInsight Community.
Trino with HDInsight on AKS provides JDBC driver, which supports Microsoft Entra authentication and adds few parameters for it.
Install
JDBC driver jar is included in the Trino CLI package, Install Trino CLI for HDInsight on AKS. If CLI is already installed, you can find it on your file system at following path:
Windows:
C:\Program Files (x86)\Microsoft SDKs\Azure\TrinoCli-<version>\lib
Linux:
~/lib/trino-cli
Authentication
Trino JDBC driver supports various methods of Microsoft Entra authentication. The following table describes the important parameters and authentication methods. For more information, see Authentication.
Parameter | Meaning | Required | Description |
---|---|---|---|
auth | Name of authentication method | No | Determines how user credentials are provided. If not specified, uses AzureDefault . |
azureClient | Client ID of service principal/application | Yes for AzureClientSecret, AzureClientCertificate . |
|
azureTenant | Microsoft Entra tenant ID | Yes for AzureClientSecret, AzureClientCertificate . |
|
azureCertificatePath | File path to certificate | Yes for AzureClientCertificate . |
Path to pfx/pem file with certificate. |
azureUseTokenCache | Use token cache or not | No | If provided, access token is cached and reused in AzureDefault, AzureInteractive, AzureDeviceCode modes. |
azureScope | Token scope | No | Microsoft Entra scope string to request a token with. |
password | Client secret for service principal | Yes for AzureClientSecret . |
Secret/password for service principal when using AzureClientSecret mode. |
accessToken | JWT access token | No | If access token obtained externally, can be provided using this parameter. In this case, auth parameter isn't allowed. |
Example - connection strings
Description | JDBC connection string |
---|---|
AzureDefault | jdbc:trino://cluster1.pool1.region1.projecthilo.net |
Interactive browser authentication | jdbc:trino://cluster1.pool1.region1.projecthilo.net?auth=AzureInteractive |
Use token cache | jdbc:trino://cluster1.pool1.region1.projecthilo.net?auth=AzureInteractive&azureUseTokenCache=true |
Service principal with secret | jdbc:trino://cluster1.pool1.region1.projecthilo.net?auth=AzureClientSecret&azureTenant=11111111-1111-1111-1111-111111111111&azureClient=11111111-1111-1111-1111-111111111111&password=placeholder |
Using JDBC driver in Java code
Locate JDBC jar file and install it into local maven repository:
mvn install:install-file -Dfile=<trino-jdbc-*.jar> -DgroupId=io.trino -DartifactId=trino-jdbc -Dversion=<trino-jdbc-version> -Dpackaging=jar -DgeneratePom=true
Download and unpack sample java code connecting to Trino using JDBC. See included README.md for details and examples.
Using open-source Trino JDBC driver
You can also obtain access token externally and pass it to open source Trino JDBC driver, sample java code with this authentication is included in using JDBC driver in java code section.