Presto JDBC调用语句

huangapple go评论78阅读模式
英文:

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)

huangapple
  • 本文由 发表于 2020年10月6日 20:27:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/64225795.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定