ExecuteQuery() vs getResultSet() in Java

前端 未结 2 1903
感情败类
感情败类 2021-02-10 06:26

What is the difference between statement.executeQuery and statement.getResultSet(). I believe both will return ResultSet for a select stat

2条回答
  •  無奈伤痛
    2021-02-10 06:39

    Check out the JavaDoc for these methods. getResultSet can return null but executeQuery never return null.

    There are also more constraints. For example executeQuery cannot be called on a PreparedStatement or CallableStatement.

提交回复
热议问题