import java.sql.*;

public class UpdateCoffees { 
  public static void main( String[] args ) { 

    Connection con; 
    Statement stmt; 
    String url = "jdbc:oracle:thin:@127.0.0.1:1521:orcl"; 
    
    try { 
      // 1. JDBC µå¶óÀÌ¹ö ·Îµù 
      Class.forName( "oracle.jdbc.driver.OracleDriver" ); 
    } catch( java.lang.ClassNotFoundException e ) { 
      System.err.print( "ClassNotFoundException :" ); 
      System.err.println( e.getMessage() ); 
    } 
    try { 
      // 2. Connection ¸Î±â 
      con = DriverManager.getConnection( url, "scott", "tiger" ); 
      stmt = con.createStatement();
      // 3.SQL ½ÇÇà 
      String query = "UPDATE coffees " +
        "SET sales = 75 " +
        "WHERE cof_name LIKE 'Colombian'";

      stmt.executeUpdate( query );
      //5. ÀÚ¿ø ¹ÝÈ¯ 
      con.close(); 
      stmt.close(); 
    } catch( SQLException ex ) { 
      System.out.println( "SQLException : " + ex.getMessage() ); 
    }
  }
}
