Announcement Announcement Module
Collapse
No announcement yet.
Java 1.5 required for a JdbcTemplate method? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Java 1.5 required for a JdbcTemplate method?

    I'm trying to use the JdbcTemplate queryForRowSet method (Spring 1.2 final), but I'm getting the following error:
    java.lang.NoClassDefFoundError: javax/sql/rowset/CachedRowSet

    It appears that javax.sql.rowset.CachedRowSet is in java 1.5, but not in java 1.4. Guess I basically can't use that method with the version of Java I'm running, but would at least be nice if the JavaDoc pointed that out.

    e.g. example code:
    SqlRowSet rs = jt.queryForRowSet(sql.toString(), params, types);

    It's also interesting that the JavaDoc for the method states that results will be mapped to an SqlRowSet object which is a wrapper class for javax.sql.RowSet. However, it also implies that it could possibly wrap javax.sql.rowset.CachedRowSet, which seems to be the case.

  • #2
    To use a RowSet feature you need a compatible RowSet implementation. Sun provides one in J2SE 5.0 that is based on JSR 114. They also produced a JSR 114 RI that can be used with Java 1.4. You can just copy the lib/j2ee/rowset.jar from the Spring distribution to your lib directory.

    The SqlRowSet wraps any implementation of javax.sql.RowSet. Since we are dealing with disconnected results here, the implementation will most likely also implement CachedRowSet, but you can't get to those methods from the SqlRowSet interface.

    As more RowSet implementations are made available we'll probably expand the functioonality so you'll be able to plug in your favorite implementation.

    Comment

    Working...
    X