System.out.println("id="+rs.getInt(1)+"||name:"+rs.getString(2)); } }catch(Exception e){e.printStackTrace();} finally{ if(rs!=null){ rs.close(); } if(pst!=null){ pst.close(); } if(conn!=null){ conn.close(); } if(session!=null){ session.close(); } } } public static void main(String [] args) throws SQLException{ TestDao td=new TestDao(); td.queryOther(); } } |