/* * This sample shows how to list all the names from the EMP table * * It uses the JDBC thin driver. */ // You need to import the java.sql package to use JDBC import java.sql.*; class Employee { public static void main (String args []) throws SQLException, ClassNotFoundException { // Load the Oracle JDBC driver Class.forName ("oracle.jdbc.driver.OracleDriver"); // Connect to the database // You can put a database name after the @ sign in the connection URL. Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@ararat:1521:SIREC", "binomeXX", "io21"); // Create a Statement Statement stmt = conn.createStatement (); // Select the ENAME column from the EMP table ResultSet rset = stmt.executeQuery ("select CRU from VIN"); // Iterate through the result and print the employee names while (rset.next ()) System.out.println (rset.getString (1)); } }