CachedRowSet Concurrency

Discussion in 'Java' started by cksanjose, Nov 14, 2007.

  1. cksanjose

    cksanjose Guest

    I have an application that starts a new process every 15 minutes. I
    create a new thread for each process so it is possible that they will
    run concurrently. I have a data access layer that returns a
    CachedRowSet object. When I only have 1 process running, the program
    is fine. As soon as another process starts, I start getting errors in
    the data access layer. I get an exception in
    My data access layer method looks like this:

    public RowSet retrieve(String sql)
    Connection connection = null;
    ResultSet resultset = null;
    CachedRowSet rowset = null;
    Statement statement = null;

    connection = Current.getConnection();
    statement =
    resultset = statement.executeQuery(sql);
    rowset = new CachedRowSetImpl();
    catch (SQLException sqle)


    connection = null;


    return rowset;
    cksanjose, Nov 14, 2007
    1. Advertisements

  2. cksanjose

    Lew Guest

    What is the exact message from the exception?

    What are the first few exact lines of the stack trace?
    We might need an SSCCE to answer this. We certainly need to know what the
    error is.


    Creating an SSCCE often helps one discover an answer as they're documenting
    the question.
    Oh, please do not use TAB characters in Usenet listings!
    Hmm - a mysterious undocumented class with a black-box method. There's no way
    this could in any way be involved with the problem.
    You may wish to read up on "SQL Injection attacks".
    Note that exceptions could leave the ResultSet or the Statement not close()d.

    What would that induce?
    You should also emit the message and the SQL error code.
    What do you imagine that this accomplishes?

    The variable goes out of scope anyway. The assignment accomplishes nothing,
    and indeed might be optimized away.
    Lew, Nov 14, 2007
    1. Advertisements

  3. cksanjose

    cksanjose Guest


    Thanks for the quick response.

    The stack trace is listed but the inner exception error is
    The error is:
    at com.sun.rowset.CachedRowSetImpl.populate(
    at com.gaic.crop.ewa.eWADataAccess.retrieve(
    at com.gaic.crop.ewa.eWADataAccess.retrieve(
    at java.util.concurrent.ThreadPoolExecutor
    at java.util.concurrent.ThreadPoolExecutor
    cksanjose, Nov 14, 2007
  4. cksanjose

    Esmond Pitt Guest

    Like Andrew, I'm pretty suspicious of Current.getConnection(). If it
    doesn't get you a connection from a driver-managed connection pool it is
    almost certainly the source of the problem.
    Esmond Pitt, Nov 14, 2007
  5. Andrew who? Did you mean, 'Lew'?
    Andrew Thompson, Nov 15, 2007
  6. cksanjose

    Esmond Pitt Guest

    err, oops, yes ...
    Esmond Pitt, Nov 15, 2007
  7. cksanjose

    Daniel Pitts Guest

    People tend to confuse you two. I don't think I've ever mistaken Lew
    for Andrew, but maybe some people only read the last two letters? :)

    Joking aside, both of you are very helpful in this community, so I can
    see why people confuse you.
    Daniel Pitts, Nov 15, 2007
  8. If they see the letters SSCCE, they might also get confused.

    Lew is the single greatest promoter of the SSCCE (according
    to my estimates of seeing 'SSCCE' pop up in my ..Google
    Alerts). Lew mentions SSCCEs more often than I do.

    <a little tongue in cheek>
    Great minds think alike.
    </a little tongue in cheek>
    Andrew Thompson, Nov 17, 2007
  9. cksanjose

    Lew Guest

    I never even heard of SSCCEs until I learned of them from Andrew.
    Lew, Nov 17, 2007
    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.