public SelectMaxNum ( ) {
}
public void loadDriver ( ) throws ClassNotFoundException, Exception {
Class.forName ( "oracle.jdbc.driver.OracleDriver" ) .newInstance ( ) ;
}
public int getMaxNum ( ) throws SQLException {
String url = "jdbc:oracle:thin:@129.254.75.152:1521:orcl816" ;
Connection con ;
Statement stmt ;
con = DriverManager.getConnection ( url, "scott", "tiger" ) ;
stmt = con.createStatement ( ) ;
String CountQuery = "select max ( BNUM ) as rc from board " ;
ResultSet rc = stmt.executeQuery ( CountQuery ) ;
rc.next ( ) ;
int num = rc.getInt ( "rc" ) + 1 ;
stmt.close ( ) ;
con.close ( ) ;
return num ;
}
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 ;
}
