/*
 * This sample shows how to list all the names from the EMP table
 */

// You need to import the java.sql package to use JDBC
import java.sql.*;

class ODBCEmployee
{
  public static void main (String args [])
       throws SQLException
  {
    // Load de ODBC JDBC driver
    DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
    Connection conn = DriverManager.getConnection ("jdbc:odbc:company");

    // Create a Statement
    Statement stmt = conn.createStatement ();

    // Select the ENAME column from the EMP table
    ResultSet rset = stmt.executeQuery ("select ENAME, JOB from EMP");

    // Iterate through the result and print the employee names
    while (rset.next ())
      System.out.println (rset.getString (1));

    // Close the RseultSet
    rset.close();

    // Close the Statement
    stmt.close();

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