In JDBC how does one know if the DDL statement was executed successfully?

我是研究僧i 提交于 2019-12-01 18:20:44

A failing statement will always raise an SQLException regardless of which method is used to execute it. executeUpdate is suitable for any statement that cannot produce a ResultSet, which makes it fit the bill perfectly for a DDL statement.

Unless you wrap the DDL in PL/QSL and catch the exception, it will bubble up to the JDBC call.

As far as which one to use, either one works fine, because for DDL you should ignore the return value anyway.

DDLs don't register as "row counts", unlike DML, so just use try/catch to catch failures, and assume in the absence of an exception, that it was successful.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!