java之java.sql.SQLException: ResultSet is from UPDATE. No Data.

問題解釋:java調用存儲過程的時候,查詢結果不能經過ResultSet來查詢,須要經過CallableStatement來查詢,java

  好比:sql

ResultSet rs = callableStatement.executeQuery(); while(rs.next()){ int empno = rs.getInt(1); String empname = rs.getString(2); System.out.println(empno); System.out.println(empname); }


//這種查詢方式錯誤,報java.sql.SQLException: ResultSet is from UPDATE. No Data.


應該經過下面的方式:
  int empno = callableStatement.getInt(1);  String empname = callableStatement.getString(2);  System.out.println(empno);  System.out.println(empname);
相關文章
相關標籤/搜索