/* * This sample shows how to list all entries from the table dogs in the database * * It uses the JDBC OCI8 driver. */ // You need to import the java.sql package to use JDBC import java.sql.*; //You need to import the math package import java.math.*; class TestCSUH2 { public static void main (String args []) throws SQLException, ClassNotFoundException { // Load the Oracle JDBC driver Class.forName ("oracle.jdbc.driver.OracleDriver"); try{ // Connect to the database //Here we are connecting to server bosack (134.154.11.126) at port 1521 and sid labdb Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@(description=(address_list=(address=(protocol=tcp)(host=134.154.11.126)(port=1521)))(connect_data=(sid=labdb)))", "lgrewe", "lgrewe"); // Create a Statement Statement stmt = conn.createStatement (); // Select the all (*) from the table JAVATEST ResultSet rset = stmt.executeQuery("select * from dogs"); System.out.println(rset); // Iterate through the result and print the employee names while (rset.next ()) //get next row of table returned { for(int i=1; i