英文:
Presto JDBC Call statements
问题
可以使用JDBC执行CALL system.sync_partition_metadata('dummy','dummy','FULL')
吗?因为Presto JDBC驱动程序不支持CallableStatements。
英文:
Is it possible to execute CALL system.sync_partition_metadata('dummy','dummy','FULL')
using JDBC as Presto JDBC driver does not support CallableStatements?
答案1
得分: 4
Presto JDBC驱动程序不支持 io.prestosql.jdbc.PrestoConnection#prepareCall
方法(请提交问题),但您可以使用 Statement
来完成这个操作:
try (Connection connection = DriverManager.getConnection("jdbc:presto://localhost:8080/hive/default", "presto", "")) {
try (Statement statement = connection.createStatement()) {
boolean hasResultSet = statement.execute("CALL system.sync_partition_metadata('default', 'table_name', 'FULL')");
verify(!hasResultSet, "unexpected resultSet");
}
}
(顺便说一句,您可以随时在 Trino(前身为Presto SQL)社区Slack 上获取更多关于Presto的帮助)
英文:
Presto JDBC driver does not support io.prestosql.jdbc.PrestoConnection#prepareCall
methods (please file an issue), but you can use Statement
for this:
try (Connection connection = DriverManager.getConnection("jdbc:presto://localhost:8080/hive/default", "presto", "")) {
try (Statement statement = connection.createStatement()) {
boolean hasResultSet = statement.execute("CALL system.sync_partition_metadata('default', 'table_name', 'FULL')");
verify(!hasResultSet, "unexpected resultSet");
}
}
(BTW you can get always get more help with Presto on Trino (formerly Presto SQL) community slack)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论