R
R
I have been trying to use the CachedRowsetImpl (SUN's reference
Implementation) to run some queries against Oracle.
I am using this mainly because I can do paging by setting the
setPazeSize().
The qurying and paging works okay , but it requires that I keep the
connection open while I am iterating through pages.
That was not my unserstanding from the reading of the API.
I can close it after populating it and the CRS (Cached ResultSet) is
supposed to create the connection from the parameters for subsequent
gets.
Am I missing some thing ?
See the examples below:
String query = "select * from TEST";
conn = dataSource.getConnection(uid , pwd);
PreparedStatement ps = conn.prepareStatement(query,
rs.TYPE_SCROLL_INSENSITIVE, rs.CONCUR_READ_ONLY );
rs = ps.executeQuery();
crs = new CachedRowSetImpl();
crs.setPageSize(3);
crs.populate(rs,1);
and then iterate through pages works okay. But if I close the
connection after the populate , it only displayes ONE page and then get
an error about connection being closed.
I have tried using the second method of populating the data using
CRS.execute(conn) where conn is connection. If I close the connection
after the execute I get the same error.
I have tried setting the connection params also as below with the same
results:
crs.setDataSourceName(jndiName);
crs.setUsername(uid);
crs.setPassword(pwd);
Any clues >?????
Implementation) to run some queries against Oracle.
I am using this mainly because I can do paging by setting the
setPazeSize().
The qurying and paging works okay , but it requires that I keep the
connection open while I am iterating through pages.
That was not my unserstanding from the reading of the API.
I can close it after populating it and the CRS (Cached ResultSet) is
supposed to create the connection from the parameters for subsequent
gets.
Am I missing some thing ?
See the examples below:
String query = "select * from TEST";
conn = dataSource.getConnection(uid , pwd);
PreparedStatement ps = conn.prepareStatement(query,
rs.TYPE_SCROLL_INSENSITIVE, rs.CONCUR_READ_ONLY );
rs = ps.executeQuery();
crs = new CachedRowSetImpl();
crs.setPageSize(3);
crs.populate(rs,1);
and then iterate through pages works okay. But if I close the
connection after the populate , it only displayes ONE page and then get
an error about connection being closed.
I have tried using the second method of populating the data using
CRS.execute(conn) where conn is connection. If I close the connection
after the execute I get the same error.
I have tried setting the connection params also as below with the same
results:
crs.setDataSourceName(jndiName);
crs.setUsername(uid);
crs.setPassword(pwd);
Any clues >?????