백터형 자료 반환을 위한 설정
{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String strQuery = null;
Vector boList = new Vector();
백터형 변수 boList 생성.. 토탈레코드 구할 때 쓰인다.
try{
conn = pool.getConnection();
풀링기법을 공유하고 있으므로 따로 풀링객체 생성없이 가져온다
}catch(Exception e){
System.out.println("Error:커넥션 가져오기 실패!!");
}
try
{
stmt = conn.createStatement();
strQuery = "select * from gesi order by pos asc";
셀렉트를 이용하여 테이블안의 모든 내용을 불러오자
order by pos asc 는 pos 레코드를 기준으로 정렬한다는 내용인데
포스 레코드는 없으니 넘어가자.
rs = stmt.executeQuery(strQuery);
rs 에 담아주고
while (rs.next()){
다음 레코드가 있으면 계속 반복
BoBean ListBo = new BoBean();
빈즈형 변수 ListBo 생성
ListBo.setTitle(rs.getString("title"));
빈즈형 변수의 setTitle 메소드를 실행시키는데 값으로 서버의 title 를 가져간다.
요기서 빈즈에 저장되게 되고 리스트페이지에서 빈즈를 불러와
리스트 업이 완료되게 된다.
boList.add(ListBo);
백터형변수 boList 에다가 빈즈의 실행결과를 담자.
}
}
catch (SQLException ex2)
{
System.out.println("Exception" + ex2);
}
finally
{
pool.freeConnection(conn,stmt,rs);
풀링기법을 닫아주고
}
return boList;
리스트 페이지 boList = Bo.getBoList(); 에서 리턴된 값을 가져오게 된다.
}
}
댓글 없음:
댓글 쓰기