 import java.sql.*;

public class selectREHBER {
                public static void main(String args[]) {                             
                String url = "jdbc:odbc:prog";
                                Connection con;
                                Statement stmt;
                String query = "select * 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();
                     ResultSet rs = stmt.executeQuery(query);      
                System.out.println("Kahve türleri ve fiyatları:");
                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());
                                }
                }
}

