CachedRowSetImpl , paging and connection connection

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 >?????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top