jdbc:presto://{endpoint}:10999/?sessionProperties=presto.engine:{DataEngineName};region:{Region};database:{DatabaseName};catalog:{Catalog}&extraCredentials=secretkey:{SecretKey};secretid:{SecretId}
Class.forName("com.facebook.presto.jdbc.PrestoDriver");
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);
Parameter | Required | Description |
presto.engine | Yes | The name of the Standard Presto Engine |
database | Yes | The name of the database |
secretkey | Yes | The SecretKey from Tencent Cloud API Key Management |
secretid | Yes | The SecretId from Tencent Cloud API Key Management. |
region | Yes | The region. Currently, DLC services support the following: 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 | The name of the data catalog |
extraCredentials | Yes | SecretKey: The SecretKey from Tencent Cloud API Key Management |
| | SecretId: The SecretId from Tencent Cloud API Key Management |
user | Yes | The user's APPID |
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();}
Was this page helpful?