第12讲 数据库编程.pptVIP

  • 10
  • 0
  • 约1.58万字
  • 约 58页
  • 2015-08-12 发布于广东
  • 举报
定义Connection的方法 // 获取数据库连接方法 public Connection getCon() throws Exception { try { Class.forName(drivername); con = DriverManager.getConnection(url, user, pass); return con; } catch (SQLException e) { System.err.println(e.getMessage()); throw e; } 定义ResultSet 方法 public ResultSet executeQuery(String sql) throws Exception { try { con = getCon(); stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); rs = stmt.executeQuery(sql); } catch (SQLException ex) { System.err.println(ex.getMessage()); } return rs; } 执行更新操

文档评论(0)

1亿VIP精品文档

相关文档