/* * This sample can be used to check the JDBC installation. * Just run it and provide the connect information. It will select * "Hello World" from the database. */ // You need to import the java.sql package to use JDBC import java.sql.*; class JdbcCheckup { public static void main (String args []) throws SQLException, IOException { // Load the Oracle JDBC driver DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); System.out.print ("Connecting to the database..."); System.out.flush (); System.out.println ("Connecting..."); Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@155.210.155.149:1521:siguedb","system","multiscan17sf"); System.out.println ("connected."); // Create a statement Statement stmt = conn.createStatement (); ResultSet rset = stmt.executeQuery ("select * from department"); while (rset.next ()) System.out.println (rset.getString (1)); System.out.println ("Your JDBC installation is correct."); // close the resultSet rset.close(); // Close the statement stmt.close(); // Close the connection conn.close(); } }