import java.net.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;

public class jdbc extends Frame 
{  
    Choice students;
    Choice grades;   
    Connection connection;
    Statement statement;

    public jdbc()
    {  
        students = new Choice();
        grades = new Choice();
      
        setLayout(new FlowLayout());

        try 
        {  
             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
           
             connection = DriverManager.getConnection(
                 "jdbc:odbc:students", "Steve", "password");

             statement = connection.createStatement();         
         
             String SQL = "SELECT Name FROM Students"; 
             ResultSet resultset = statement.executeQuery(SQL);
             while (resultset.next()) 
                 students.addItem(resultset.getString(1));

             SQL = "SELECT Grade FROM Students"; 
             resultset = statement.executeQuery(SQL);
             while (resultset.next()) 
                 grades.addItem(resultset.getString(1));
      }
      catch(Exception e) {}  

      add(students);
      add(grades);
   }

   public static void main (String args[]) 
   {  
       Frame f = new jdbc();

       f.setSize(300, 300);

       f.addWindowListener(new WindowAdapter() {public void
           windowClosing(WindowEvent e) {System.exit(0);}});

       f.show();
   }
   
}
