public ReadItem ( ) {
}
public void loadDriver ( ) throws ClassNotFoundException, Exception {
Class.forName ( "oracle.jdbc.driver.OracleDriver" ) .newInstance ( ) ;
}
public BoardData read ( String num ) throws SQLException {
String query = "select BNUM, BDATE, BNAME, BEMAIL, BTITLE, BCONTENT,BPASSWORD from board where BNUM = " + num.trim();
BoardData data = null ;
String url = "jdbc:oracle:thin:@localhost:1521:etri" ;
Connection con ;
Statement stmt ;
con = DriverManager.getConnection ( url, "scott", "tiger" ) ;
stmt = con.createStatement ( ) ;
ResultSet rs = stmt.executeQuery ( query ) ;
rs.next ( ) ;
int bnum = rs.getInt ( "BNUM" ) ;
Date bdate = rs.getDate ( "BDATE" ) ;
String btitle = rs.getString ( "BTITLE" ) ;
String bname = rs.getString ( "BNAME" ) ;
String bemail = rs.getString ( "BEMAIL" ) ;
String bcontent = rs.getString ( "BCONTENT" ) ;
String bpassword = rs.getString ( "BPASSWORD" ) ;
data = new BoardData ( bnum, bdate, btitle, bname, bemail, bpassword, bcontent ) ;
stmt.close ( ) ;
con.close ( ) ;
return data ;
}
