import java.sql.*; class OracleCon{ public static void main(String args[]){ try{ //step1 load the driver class Class.forName("oracle.jdbc.driver.OracleDriver"); //step2 create the connection object Connection con=DriverManager.getConnection( "jdbc:oracle:thin:@192.168.1.150:1521:SFLDB1","CS4DB-TEMP","ABCDEFGH"); //step3 create the statement object Statement stmt=con.createStatement(); //step4 execute query String query = "create table emp1(id number(10),name varchar2(40),age number(3))"; stmt.execute(query); query = "INSERT INTO emp1(id, name, age) VALUES (1, 'Shan', 49)"; stmt.execute(query); query = "INSERT INTO emp1(id, name, age) VALUES (2, 'Jay', 48)"; stmt.execute(query); ResultSet rs=stmt.executeQuery("select * from emp1"); while(rs.next()) System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3)); //step5 close the connection object con.close(); } catch(Exception e) { System.out.println(e);} } }