The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.

Presto JDBC Access

Last updated: 2026-05-20 16:42:43

Note:
The Presto engine is deprecated and only available for existing users.

Supported Engine Types

Standard Presto Engine

Preparing the Environment

Dependency: JDK 1.8
Note:
Currently, only the Standard Presto Engine supports access via Presto JDBC. If you are using the SuperSQL engine, see DLC JDBC Access.

Connecting to a Standard Presto Engine

Creating a Service Access Link

Go to the Data Engine page, click the gateway details button, and then go to the gateway details page.

Click Create Private Link, select the VPC and subnet where the submission server resides, and then click Create. Two access links are generated, one for the Hive2 protocol and the other for the Presto protocol. The Presto protocol is used to connect to the Standard Presto Engine, as shown in the following figure.
Note:
Creating a Private Link establishes network connectivity between the engine network and the selected VPC. The submission server can be any accessible server within the selected VPC and is used solely for task submission. If there is no submission server in the selected VPC, you can create a new server to serve as the submission server.

jdbc:presto://{endpoint}:10999/?sessionProperties=presto.engine:{DataEngineName};region:{Region};database:{DatabaseName};catalog:{Catalog}&extraCredentials=secretkey:{SecretKey};secretid:{SecretId}

Loading the JDBC Driver

Class.forName("com.facebook.presto.jdbc.PrestoDriver");

Creating a Connection via DriverManager

String url = "jdbc:presto://{endpoint}:10999/?sessionProperties=presto.engine:{DataEngineName};region:{Region};database:{DatabaseName};catalog:{Catalog}&extraCredentials=secretkey:{SecretKey};secretid:{SecretId}";
Properties properties = new Properties();
properties.setProperty("user", {AppId});
Connection connection = DriverManager.getConnection(url, properties);

JDBC Connection String Parameters

Parameter
Required
Description
presto.engine
Yes
Standard Presto engine name
database
Yes
Database name.
secretkey
Yes
The SecretKey in TencentCloud API Key Management
secretid
Yes
The SecretId in TencentCloud API Key Management
region
Yes
Region. Currently, the DLC service supports ap-nanjing, ap-beijing, ap-beijing-fsi, ap-guangzhou, ap-shanghai, ap-chengdu, ap-chongqing, na-siliconvalley, ap-singapore, ap-hongkong, na-ashburn, eu-frankfurt, and ap-shanghai-fsi.
catalog
Yes
Data Catalog Name
extraCredentials
Yes
SecretKey: The SecretKey in TencentCloud API Key Management
SecretId: The SecretId in TencentCloud API Key Management
user
Yes
User AppID.

Complete Data Query Example

import com.facebook.presto.jdbc.PrestoStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;

public class TestJDBCKyuubiPresto {
public static void main(String[] args) throws SQLException {
try {
Class.forName("com.facebook.presto.jdbc.PrestoDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
return;
}
String url = "jdbc:presto://{endpoint}:10999/?sessionProperties=presto.engine:{DataEngineName};region:{Region};database:{DatabaseName};catalog:{Catalog}&extraCredentials=secretkey:{SecretKey};secretid:{SecretId}";
Properties properties = new Properties();
properties.setProperty("user", {AppId});
Connection connection = DriverManager.getConnection(url, properties);
PrestoStatement statement = (PrestoStatement) connection.createStatement();
String sql = "show catalogs";
statement.execute(sql);
ResultSet rs = statement.getResultSet();
while (rs.next()) {
System.out.println(rs.getString(1));
}
rs.close();
statement.close();
connection.close();
}
After compilation is complete, you can submit the jar package to the submission server for execution.