ivaneeo's blog

自由的力量,自由的生活。

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks
private void disconnect() throws Exception {
  if (con != null) {
  con.close();
  con = null;
  }
}

protected void connect() throws Exception {
disconnect();
con = getConnection();
}

上面是一般写法.
    public Connection getConnection() throws Exception {
        Class.forName(props.getProperty("driver"));
        String url = props.getProperty("url");
        Connection con = DriverManager.getConnection(url, props);
//        showWarnings(con.getWarnings());
        initLanguage(con);

        return con;
    }
posted on 2005-08-04 21:12 ivaneeo 阅读(174) 评论(0)  编辑  收藏 所属分类: java魔力

只有注册用户登录后才能发表评论。


网站导航: