public UpdateItem ( ) {
}
public void loadDriver ( ) throws ClassNotFoundException, Exception {
Class.forName ( "oracle.jdbc.driver.OracleDriver" ) .newInstance ( ) ;
}
public boolean update ( int num, String email, String title, String content, String password, String remoteAddr ) throws SQLException {
String url = "jdbc:oracle:thin:@localhost:1521:etri" ;
Connection con ;
Statement stmt ;
boolean isNormalExit = false ;
con = DriverManager.getConnection ( url, "scott", "tiger" ) ;
stmt = con.createStatement ( ) ;
String query = "update board set BDATE = SYSDATE, BEMAIL = '" + email + "',   BTITLE = '" + toHangul(title) + "',  BCONTENT = '" + toHangul(content) + "',BPASSWORD = '" + password + "' where bnum = " + num;
int rowChange = stmt.executeUpdate ( query ) ;
if ( rowChange == 1 ) isNormalExit = true;
else isNormalExit = false;
stmt.close ( ) ;
con.close ( ) ;
return isNormalExit ;
}
private String toHangul ( String str ) {
if ( str == null ) return null;
try {
return new String ( str.getBytes ( "8859_1" ) , "KSC5601" ) ;
}
catch ( UnsupportedEncodingException e ) {
}
return null ;
}
private String hangulTo ( String str ) {
if ( str == null ) return null;
try {
return new String ( str.getBytes ( "KSC5601" ) , "8859_1" ) ;
}
catch ( UnsupportedEncodingException e ) {
}
return null ;
}
