小编Tuv*_*vaa的帖子

ResultSet在java中关闭后不允许操作

我有一个名为Database的类.

    public class Database {
    public Connection connect = null;
    public Statement st = null;
    public PreparedStatement ps = null;
    public ResultSet rs = null;

    public boolean connectDB() throws Exception {
      try {

      Class.forName("com.mysql.jdbc.Driver");

      connect = DriverManager
        .getConnection("jdbc:mysql://localhost/ots?"
              + "user=root&password=mongolia");
    } catch (Exception e) {
      System.out.println(e);
    }
    return true;
   }

    public void disconnectDB() {
    try {
      if (rs != null) {
        rs.close();
      }

      if (st != null) {
        st.close();
      }

      if (connect != null) {
        connect.close();
      }
    } catch (Exception …
Run Code Online (Sandbox Code Playgroud)

java mysql jsp jdbc resultset

0
推荐指数
1
解决办法
6030
查看次数

标签 统计

java ×1

jdbc ×1

jsp ×1

mysql ×1

resultset ×1