import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.sql.RowSetEvent;
import javax.sql.RowSetListener;
import javax.sql.rowset.JdbcRowSet;
import javax.sql.rowset.RowSetProvider;
classRowSetDemo
{
public static void main(String args[])
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
JdbcRowSetrowSet = RowSetProvider.newFactory().createJdbcRowSet();
rowSet.setUrl("jdbc:oracle:thin:@localhost:1521:xe");
rowSet.setUsername("scott");
rowSet.setPassword("tiger");
rowSet.setCommand("select * from Student");
rowSet.execute();
while(rowSet.next())
{
System.out.println("RollNo: "+ rowSet.getInt(1));
System.out.println("Name: "+ rowSet.getString(2));
System.out.println("Course: "+ rowSet.getString(3));
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}