import java.sql.*;

class Insert
{
  public static void main (String args [])
       throws SQLException
  {
    // Load the Oracle JDBC driver
    try {
      Class.forName("oracle.jdbc.driver.OracleDriver");
    } catch (ClassNotFoundException e) {
      System.out.println ("Oracle device driver does not exist");
      System.exit(0);
    }

    // Connect to the database
    // You can put a database name after the @ sign in the connection URL.
    Connection conn =
    DriverManager.getConnection ("jdbc:oracle:thin:@oradev:10521:D", "rramos", "raul");

    // Create a Statement
    PreparedStatement stmt = conn.prepareStatement 
                ("insert into COFFEES values (?, ?, ?, 0, 0)" );

    stmt.setString(1, "French");
    stmt.setInt(2, 300);
    stmt.setDouble(3, 6.87);
    int r=stmt.executeUpdate ();

    stmt.setString(1, "Decaf");
    stmt.setInt(2, 250);  // Same price as before
    r+=stmt.executeUpdate ();

    System.out.println("A total of "+r+" were rows inserted");

    // Close the Statement
    stmt.close();

    // Close the connection
    conn.close();
  }
}

