CachedRowSetImpl , paging and connection connection

Discussion in 'Java' started by R, Mar 24, 2006.

  1. R

    R Guest

    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 >?????
     
    R, Mar 24, 2006
    #1
    1. Advertisements

  2. R

    R Guest

    Any one ??
     
    R, Mar 26, 2006
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.