public ReadBoardList ( ) {
}
public void loadDriver ( ) throws ClassNotFoundException, Exception {
Class.forName ( "oracle.jdbc.driver.OracleDriver" ) .newInstance ( ) ;
}
public BoardData[] readList ( ) throws SQLException {
String url = "jdbc:oracle:thin:@localhost:1521:etri" ;
Connection con ;
Statement stmt ;
String query = "select BNUM, BDATE, BNAME, BEMAIL, BTITLE from board order by bnum " ;
String CountQuery = "select count ( * ) as rc from board " ;
con = DriverManager.getConnection ( url, "scott", "tiger" ) ;
stmt = con.createStatement ( ) ;
ResultSet rs = stmt.executeQuery ( CountQuery ) ;
rs.next ( ) ;
int RecordCount = rs.getInt ( "rc" ) ;
totalListNum = RecordCount ;
if ( totalListNum == 0 ) return null;
totalPage = totalListNum/HTMLLib.LINENUM+1 ;
if ( totalListNum!= 0 && pageListNum == 0 ) pageListNum=HTMLLib.LINENUM;
BoardData[] bd = new BoardData[totalListNum] ;
int i = 0 ;
rs = stmt.executeQuery ( query ) ;
while ( rs.next ( ) ) {
bd[i] = new BoardData ( rs.getInt ( "BNUM" ) , rs.getDate ( "BDATE" ) ,rs.getString ( "BTITLE" ) , rs.getString ( "BNAME" ) , rs.getString ( "BEMAIL" ) , null, null ) ;
i++ ;
}
stmt.close ( ) ;
con.close ( ) ;
return bd ;
}
public int getTotalListNum ( ) {
return totalListNum ;
}
public int getTotalPage ( ) {
return totalPage ;
}
public int getPageListNum ( ) {
return pageListNum ;
}
