JDBC中 execute 与 executeUpdate的区别

Posted Draymonder

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JDBC中 execute 与 executeUpdate的区别相关的知识,希望对你有一定的参考价值。

相同点

  execute与executeUpdate的相同点:都可以执行增加,删除,修改

不同点

  execute可以执行查询语句
  然后通过getResultSet,把结果集取出来
  executeUpdate不能执行查询语句

  execute返回boolean类型,true表示执行的是查询语句,false表示执行的是insert,delete,update等等
  executeUpdate返回的是int,表示有多少条数据受到了影响

以上是关于JDBC中 execute 与 executeUpdate的区别的主要内容,如果未能解决你的问题,请参考以下文章

JDBC预编译statement(preparedstatement)和statement的比较execute与executeUpdate的区别

hibernate添加数据报错:Could not execute JDBC batch update

Jdbc execute 比工具速度慢

Hive JDBC:Permission denied: user=anonymous, access=EXECUTE, inode=”/tmp”

DB2 JDBC 驱动程序(类型 4)在 Execute() 上挂起

hibernate的Could not execute JDBC batch update错误原因及处理