The method executeQuery() cannot take arguments on a PreparedStatement or CallableStatement. Error

后端 未结 3 1770
夕颜
夕颜 2021-01-12 02:32

I am having this kind of error when trying to connect and retrieve data from my database.

The method executeQuery() cannot take arguments on a PreparedStatement or C

3条回答
  •  伪装坚强ぢ
    2021-01-12 03:22

    Just add { } for your querystring.i.e

    String queryString = "{SELECT P_ID, lname, fname, mname FROM stu_info Where lname = ?}";
    

    execute() and executeUpdate() will both work. executeQuery() only works when your procedure returns a result set.

提交回复
热议问题