Write a java program to retrieve all the rows from employee table of oracle database
import java.sql.*;
public class Abc1 { public static void main(String args[])throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); System.out.println("driver Loaded"); String str = "jdbc:odbc:nacdsn"; String un = "system"; String pw = "tiger"; Connection con = DriverManager.getConnection(str,un,pw); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from emp1"); while( rs.next() ) { System.out.println(rs.getInt(1)); System.out.println(rs.getString(2)); System.out.println("********************"); } } } |