客户端连接Starburst服务相关示例
在控制台通过客户端jar包访问Starburst服务(其中user/password为Starburst管控台登陆用户名密码)
java -jar trino-cli-361-executable.jar --server https://xxxx.sep.aliyuncs.com:8443 --user test --password
Java代码访问样例如下,需要在项目中引入Maven坐标
<!-- starburst jdbc客户端连接 --><dependency><groupId>io.trino</groupId><artifactId>trino-jdbc</artifactId><version>361</version></dependency>
String url = "jdbc:trino://xxxx.sep.aliyuncs.com:8443";Properties properties = new Properties();properties.setProperty("user", "test");properties.setProperty("password", "123456");properties.setProperty("SSL", "true");Connection connection = DriverManager.getConnection(url, properties);ResultSet resultSet= connection.prepareStatement("select count(*) from system.jdbc.tables").executeQuery();while (resultSet.next()){System.out.println(resultSet.getString(1));}
