使用
dbConn SqlConn = new dbConn();
try{
  //
}catch(Exception e){
  //
}finally{
  SqlConn.close();
}

解决方案 »

  1.   

    you can make Connection as constant variable !
    dbConn will be closed when all action have been done !
    others like Statement, ResultSet might be close just when single action have been done !
    for instance:
    try{
      SQL = ""//you sql
      Statement.method //
    }catch(){}finally{
           try{
        Statement.close();
           }catch(){
            
             }
    }all above is just my opnion ,may be it is wrong just for discussion!