import java.sql.*; public class Drive1 { public static void main (String args []) throws SQLException { // Load the Oracle JDBC driver DriverManager.registerDriver(new 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:oci8:@", "scott", "tiger"); // Create a Statement Statement stmt = conn.createStatement (); // Select the ENAME column from the EMP table // ResultSet rset = stmt.executeQuery ("select * from association"); // Iterate through the result and print the employee names // while (rset.next ()) // System.out.println (rset.getString (1)); /* PreparedStatement pstmt = null; pstmt = conn.prepareStatement("insert into result values (?, ?)"); pstmt.setInt(1, 34); pstmt.setString(2, "data34"); pstmt.addBatch(); pstmt.executeBatch(); */ // Close the RseultSet rset.close(); // Close the Statement stmt.close(); // Close the connection conn.close(); } }