Sunday, 22 January 2017

CACHEDROWSET

Note - CachedRowSet is an interface and OracleCachedRowSet is a class

import java.sql.*;
import oracle.jdbc.rowset.OracleCachedRowSet;
public class Test37 {
public static void main(String[] args) throws Exception {
OracleCachedRowSet oc = new OracleCachedRowSet();
oc.setUrl("jdbc:oracle:thin:@localhost:1521:orcl");
oc.setUsername("scott");
oc.setPassword("rakesh");
oc.setCommand("select empno,ename,sal from emp");
oc.execute();
while(oc.next())
{
System.out.println(oc.getInt(1)+" "+oc.getString(2)+" "+oc.getFloat(3));
}
}

}

No comments:

Post a Comment