 import java.sql.*;

public class insertKAHVE {
                public static void main(String args[]) {                             
                String url = "jdbc:odbc:prog";
                                Connection con;
                                Statement stmt;
                String query = "select KAHVE_ISMI, FIYAT from KAHVE";
                                try {
                    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                    } catch(java.lang.ClassNotFoundException e)
                      {
                      System.err.print("ClassNotFoundException: ");
                      System.err.println(e.getMessage());
                      }
                      try {
                      con = DriverManager.getConnection(url,
                      "myLogin", "myPassword");
                      stmt = con.createStatement();
                      stmt.executeUpdate("insert into KAHVE " +
                        "values('kolombiya',101, 7.99, 120, 0)");
                        stmt.executeUpdate("insert into KAHVE " +
                         "values('frans?z', 49, 8.99, 130, 0)");
                        stmt.executeUpdate("insert into KAHVE " +
                         "values('kafeinsiz frans?z', 51, 9.12, 110, 0)");
                        stmt.executeUpdate("insert into KAHVE " +
                         "values('espresso', 150, 9.99, 110,0)");
                        stmt.executeUpdate("insert into KAHVE " +
                         "values('brezilya', 89, 7.99, 120, 0)");
                       stmt.executeUpdate("insert into KAHVE " +
                         "values('kafeinsiz brezilya', 91, 8.15, 120, 0)");
                      ResultSet rs = stmt.executeQuery(query);      
                      System.out.println("Coffee Break Coffees and Prices:");
                      while (rs.next()) {
                      String s = rs.getString("KAHVE_ISMI");
                      float f = rs.getFloat("FIYAT");
                      System.out.println(s + "   " + f);
                                                }             
                      stmt.close();
                      con.close();          
                      } catch(SQLException ex) {
                      System.err.println("SQLException: " + ex.getMessage());
                                }
                }
}

