CachedRowSetImpl

I have been using CachedRowSetImpl for a while to populate a data table, but a few months back, I have started seeing the following warning when I compile:
warning: com.sun.rowset.CachedRowSetImpl is Sun proprietary API and may be removed in a future release
I am wondering if I should start using another API to perform data retrieval.
I have also encountered some Java heap space problem when trying to use CachedRowSetImpl with a table that contains a large number of entries (over 26000 entries). Is this to be expected? Things seems to go havoc when the call to populate is made.
Here is how it is invoked:
            rs = st.executeQuery();
            rowSet = new CachedRowSetImpl();
            rowSet.setPageSize(getRows());
            rowSet.populate(rs);Martin

IIRC, it is only the initial capacity.

Similar Messages

  • Is this a bug of  CachedRowSetImpl in JDK5.0

    Running Environment: JDK1.5.0_06, MySQL 4.1.7, JDBC3.1.12
    The sql operations are encapsulated in this code snippet:
         public static ResultSet sqlQuery(String dsname, String sql){
              Connection cnn = getConnection(dsname);
              if(cnn != null){
                   Statement stmt = null;
                   ResultSet rs = null;
                   CachedRowSet crset = null;
                   try {
                        stmt = cnn.createStatement();
                        rs = stmt.executeQuery(sql);
                   crset = new CachedRowSetImpl();
                   crset.populate(rs);                    
                        cnn.close();
                        return crset;
                   } catch (SQLException e) {
                        e.printStackTrace();
              return null;
    Then I call it in this code snippet:
         sql = "select sum(cost),'aa','bb' from shopping";
         rs = DBAction.sqlQuery("jdbc/provision",sql);     
    while(rs!=null && rs.next()){
    rs.getInt(1); //if change to rs.getFloat(1); everything is going well
    Here something wrong just happened:
    java.sql.SQLException: getInt Failed on value ( {0} ) in column {1}200.01
    at com.sun.rowset.CachedRowSetImpl.getInt(CachedRowSetImpl.java:1892)
    at jsp.givedata__jsp._jspService(givedata.jsp:7)
    at com.caucho.jsp.JavaPage.service(JavaPage.java:60)
    at com.caucho.jsp.Page.pageservice(Page.java:570)
    at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:159)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:386)
    at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
    at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
    at java.lang.Thread.run(Thread.java:595)
    Is it the sum function generates a float , and there are something wrong with
    the getInt and getLong method to convert the number? But in ResultSet
    we never need to worry about this.
    If this is a bug how can i fixed it?
    the table using above just like this:
    mysql> desc shopping;
    -------------------------------------------+
    | Field | Type | Null | Key | Default | Extra |
    -------------------------------------------+
    | cost | int(11) | YES | | NULL | |
    -------------------------------------------+
    1 row in set (0.01 sec)
    mysql> select * from shopping;
    | cost |
    | 120 |
    | 8 0 |
    1 row in set (0.00 sec)

    Make sure that you do not run Firefox in permanent Private Browsing mode.
    *https://support.mozilla.org/kb/Private+Browsing
    To see all History and Cookie settings, choose:
    *Tools > Options > Privacy, choose the setting <b>Firefox will: Use custom settings for history</b>
    *Deselect: [ ] "Always use private browsing mode"
    Do you mean names and passwords in the Password Manager or do you mean that you are no longer logged on to (remembered by) websites after closing and restarting Firefox?
    There is a difference between remembering the name and password in the Password Manager and a "remember me" check box on a web page.<br />
    The latter usually involves the creation of a special "remember me" cookie that is stored on your computer and that is send to the server.<br />
    If that "remember me" cookie is removed or gets corrupted or is not send to the server then the server won't remember you and you need to sign in once again.
    * http://kb.mozillazine.org/Cookies
    * http://kb.mozillazine.org/Password_Manager

  • Error while using CachedRowSetImpl  nextPage()

    import com.sun.rowset.CachedRowSetImpl;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.util.logging.Level;
    public class RowSet
      private CachedRowSetImpl  crs;
      public RowSet()
      public RowSet(int size,String query ,Statement stmt)
        try
          ResultSet rs = stmt.executeQuery(query);
          logger=new Logger();
          crs=new CachedRowSetImpl();
          crs.populate(rs);
          crs.setPageSize(size);
        catch(Exception ex)
          logger.log(Level.SEVERE,"Error in Getting RowSet:"+ex);
      public CachedRowSetImpl getRowSet()
        return crs;
      public static void main(String [] args)throws Exception
        DBConnector connector=new DBConnector("conf/conf.properties");
        String query="Select * from TblAccNo";
        RowSet rs=new RowSet(10,query,connector.getConnection().createStatement());
        CachedRowSetImpl rowset=rs.getRowSet();
        while(rowset.nextPage()) // error line
           while (rowset.next())
             System.out.println("" + rowset.getString("CustomerID"));
           System.out.println("One Page Ended");
          rowset.close();
    }Above code gives exception on nextPage() method i dont under stand why is it so .
    Error :
    java.sql.SQLException: Populate data before calling
         at com.sun.rowset.CachedRowSetImpl.nextPage(Unknown Source)
    at RowSet.main(RowSet.java:55)
    How to handle it please define

    Please try to set page size before call populate, and DO NOT use poppulate(ResultSet), it will populate the whole resultset without pagination (http://www.theserverside.com/discussions/thread.tss?thread_id=35306#204290)

  • Is it acceptable to use CachedRowSetImpl?

    Hi anyone:
    Is it acceptable to use CachedRowSetImpl if you cannot find a implementation from a vendor (MS SQL Server). p.s. I cannot afford to purchase one :-(
    I'm pretty new to java and have been told not to use com.sun packages.
    Any suggestions..
    Thanks

    I've never looked into details of CachedRowSet but as much as I heard, it shouldn't be a problem using that implementation. :)

  • Displaying a cachedRowSetImpl in a jsp! :-(

    I am new to servlets and jsps.
    I have a problem with cachedRowSetImpl and jsps.
    I have a sevrlet (userDisplay) that populates a cachedRowSetImpl object (called crs) and then stores this in a bean called userDisplayBean.
    I then want to access this bean from within a jsp page to diplay its results.
    How can this be acheived.
    Please Please Please help. my uni project deadline is looming :(

    Thank you very much for your help.
    I am now on my way to solving this mystery.
    I have another problem now. In my jsp i have the following lines of code :
    <jsp:useBean scope ="request" class="users.userDisplayBean" id="userInfo" />
    <jsp:getProperty name="userInfo" property="results" />
    I persume that this extracts the cachedRowImpl object from the bean because the browser displays the following:
    com.sun.rowset.CachedRowSetImpl@189b939
    Th problem that I have now is I cant make the jsp display the results of the CachedRowImpl object in a table.
    If anybody knows how to do this please please please let me know.
    Thank you very much.

  • CachedRowSetImpl and DataSource

    Hi pals,
    I got a problem with the CachedRowSetImpl. I set the DataSourceName of the CRS. When I debug, it can successfully connect to the DB and reads the data. It however throws an execution saying "java.sql.SQLException: The url cannot be null". If I give the connection to the CRS, it succeeds. What could be the solution?
    Here is the small code :
       CachedRowSet crs = new CachedRowSetImpl();
       crs.setDataSourceName("jdbc/MyDatabase");
       crs.setCommand("Select * From Employees");
       crs.execute();At the line of execute(), I can clearly see that the values are populated from the DB when I debug. It however throws exception as I mentioned above.

    Hi,
    I also have a problem with the CachedRowSet. Its a different problem but also I cannot interpret the exception I get (see my posting). These exceptions from the CachedRowSet seem to be very strange...
    Maybe there is a text or sth else out there which goes a bit into detail when these exceptions are thrown?
    Bye
    Frank

  • Trouble Populating CachedRowSetImpl with a ResultSet Containing a CLOB

    Hi,
    I need to populate a CachedRowSetImpl with a ResultSet that contains a CLOB. I am using the Oracle thin jdbc driver (ojdbc14.jar) When I populate it however, I get an exception:
    java.sql.SQLException: Invalid precision value. Cannot be less than zero
    Here is my code snippet. I get the exception when I call dor_note_dataRowSet.populate(resultSet);
    javax.naming.Context ctx = null;
    DataSource ds = null;
    Connection conn = null;
    PreparedStatement ps1 = null;
    String sqlUpdate = null;
    ResultSet resultSet = null;
    try
    ctx = new javax.naming.InitialContext();
    ds = (DataSource)ctx.lookup("<private>");
    conn = ds.getConnection();
    sqlQuery = "SELECT " +
    "DOR_NOTE_DT, DOR_NOTE_TX " +
    "FROM DOR.DOR_NOTE_DATA " +
    "WHERE DOR_NOTE_CD='SECURITY' AND " +
    "TO_CHAR(DOR_Note_Dt, 'mm/dd/yyyy') = '" + strDate + "'";
    ps1 = conn.prepareStatement(sqlQuery);
    resultSet = ps1.executeQuery();
    dor_note_dataRowSet.populate(resultSet);
    ps1.close();
    conn.close();
    catch (Exception ex) {
    log("Error Description", ex);
    error("Failed to upload file :"+ex.getMessage());
    Thanks

    I figured out how to do it

  • CachedRowSetImpl Error! Need Help

    I am using the CachedRowSet instance to store data in a resultset. I can populate the resultset into the cachedrowset instance without any error. However, when I invoked the ResultSet's next() method, I have an SQLException : "Invalid Operation : Result Set closed."
    Below is the code snippet:
    Connection connection = null;
    PreparedStatement stmt = null;
    ResultSet result = null;
    try {
       if (connection == null) connection = getConnection();    // create connection
       String sqlQuery = "SELECT * FROM STUDENT ORDER BY ID";
       stmt = connection.prepareStatement(sqlQuery);
       result = stmt.executeQuery();
       CachedRowSetImpl crs = null;
       crs = new CachedRowSetImpl();
       crs.populate(result);
       if (result.next()) {
          // Do Something
       }   else  {
          // Do Something
    catch (Exception e) {
       e.printStackTrace(System.out);
    finally {
       try {
          if (result != null) result = null;
          if (stmt != null) stmt = null;
          if (connection != null) connection.close();
       catch (SQLException sqle) {
          System.out.println(sqle.getMessage());
    }When I remove the if...else... statement or comment out the CachedRowSet.populate() method, I will not get any SQLException.
    The error log is as below:
    [10/12/04 22:13:25:795 MYT]   e8ec6d SystemOut     O com.ibm.db2.jcc.b.SQLException: Invalid operation: result set closed
    [10/12/04 22:13:25:795 MYT]   e8ec6d SystemOut     O      at com.ibm.db2.jcc.b.ca.S(ca.java(Compiled Code))
    [10/12/04 22:13:25:796 MYT]   e8ec6d SystemOut     O      at com.ibm.db2.jcc.b.ca.next(ca.java(Compiled Code))
    [10/12/04 22:13:25:796 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.next(WSJdbcResultSet.java(Compiled Code))
    [10/12/04 22:13:25:796 MYT]   e8ec6d SystemOut     O      at com.ait.dmo.StudentSearch.searchRecords(StudentSearch.java:129)
    [10/12/04 22:13:25:796 MYT]   e8ec6d SystemOut     O      at com.ait.dmo.StudentSearch.doPost(CustomerSearch.java:58)
    [10/12/04 22:13:25:796 MYT]   e8ec6d SystemOut     O      at com.ait.dmo.StudentSearch.doGet(CustomerSearch.java:31)
    [10/12/04 22:13:25:797 MYT]   e8ec6d SystemOut     O      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    [10/12/04 22:13:25:797 MYT]   e8ec6d SystemOut     O      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [10/12/04 22:13:25:797 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [10/12/04 22:13:25:797 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [10/12/04 22:13:25:797 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    [10/12/04 22:13:25:798 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [10/12/04 22:13:25:798 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [10/12/04 22:13:25:798 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    [10/12/04 22:13:25:798 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    [10/12/04 22:13:25:798 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1059)
    [10/12/04 22:13:25:799 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:588)
    [10/12/04 22:13:25:799 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:206)
    [10/12/04 22:13:25:799 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:80)
    [10/12/04 22:13:25:799 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:214)
    [10/12/04 22:13:25:799 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
    [10/12/04 22:13:25:800 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
    [10/12/04 22:13:25:800 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
    [10/12/04 22:13:25:800 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
    [10/12/04 22:13:25:800 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
    [10/12/04 22:13:25:800 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:449)
    [10/12/04 22:13:25:801 MYT]   e8ec6d SystemOut     O      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)Any reply or advice is appreciated. Thanks in advanced.

    AFAIK the underlying ResultSet (result) is closed automatically during the "crs.populate(result)" execution. You are not allowed to operate on the ResultSet after the invocation of the "populate(...)" method, you have to use the CachedRowSet instance instead.
    Just replace:
    result.next()by:
    crs.next()HTH,
    Carsten

  • Com.sun.rowset.CachedRowSetImpl - creation of copy false

    hello out there,
    I'm trying to copy a CachedRowSetImpl-Object by calling the createCopy()-method. It fails with the error message:
    "Clone failed - org.hsqldb.jdbc.jdbcResultSet".
    So I can't copy the Object.
    I have downloaded the sourcecode of the JDK and found out that the stacktrace is:
    "java.io.NotSerializableException: org.hsqldb.jdbc.jdbcResultSet
    at java.io.ObjectOutputStream.writeObject0 ObjectOutputStream.java:1075)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java
    :1369)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:13
    41)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.jav
    a:1284)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
    [... my source....]"
    This sounds possible, because ResultSet is not serializable as you know :-)
    But - why is CachedRowSetImpl trying to copy the ResultSet?
    It would be greate if someone could help me solving this problem.
    TIA
    Tobias

    A RowSet contains a kind-of pointer to the current row you're iterating, and a CachedRowSet contains its full data. A CachedRowSet has a deep copy of the row set, containing all elements. For the CachedRowSet to copy all elements, it must iterate through the RowSet and copy them.
    from the CachedRowSet API javadocs:
    Creates a RowSet object that is a deep copy of the data in this CachedRowSet objectTry something like the following pseudocode, also taken from the api javadocs:
    ResultSet rs = stmt.executeQuery("SELECT * FROM EMPLOYEES");
    CachedRowSetImpl crs = new CachedRowSetImpl();
    crs.populate(rs);

  • Using CachedRowSetImpl

    I use CachedRowSetImpl in statefull component in jboss - and connection to the oracle - and when try to populate CachedRowSetImpl with resultset - it's happend error:
    like this :
    2005-04-05 10:18:57,739 INFO [STDOUT] java.sql.SQLException: Invalid scale size. Cannot be less than zero
    2005-04-05 10:18:57,739 INFO [STDOUT]      at javax.sql.rowset.RowSetMetaDataImpl.setScale(Unknown Source)
    2005-04-05 10:18:57,739 INFO [STDOUT]      at com.sun.rowset.CachedRowSetImpl.initMetaData(Unknown Source)
    2005-04-05 10:18:57,739 INFO [STDOUT]      at com.sun.rowset.CachedRowSetImpl.populate(Unknown Source)
    2005-04-05 10:18:57,739 INFO [STDOUT]      at dao.RoleDAOImpl.init(RoleDAOImpl.java:110)
    2005-04-05 10:18:57,739 INFO [STDOUT]      at statefull.RoleFSession.getDao(RoleFSession.java:46)
    2005-04-05 10:18:57,739 INFO [STDOUT]      at statefull.RoleFSession.RolesRS(RoleFSession.java:57)
    2005-04-05 10:18:57,739 INFO [STDOUT]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2005-04-05 10:18:57,739 INFO [STDOUT]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    2005-04-05 10:18:57,755 INFO [STDOUT]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    Can somebody help me ? Maybe you have some experience with jboss and oracle an d rowset ?
    Best regards !
    Stanislav

    Relly I don't now - but I think the reason is not in init method - because when i change
    CachedRowSetImpl to JdbcRowSetImpl - every thing work fine.
    The code with JdbcRowSetImpl is such :
         rset = new JdbcRowSetImpl(conn);
                        rset.setCommand(queryString);
                        rset.setMaxRows(5);
                        rset.execute();
    The code with CachedRowSetImpl is such :
    ps = conn.prepareStatement(queryString);
    ps.executeQuery();
    rs = ps.getResultSet();          
    crs = new CachedRowSetImpl();
    crs.populate(rs);
    What do you think ?
    With Best Regards,
    Stanislav

  • CachedRowSetImpl.acceptchanges(con) don't release the connection

    Hi all,
    i've have this problem using the CachedRowSetImpl tecnology.
    this is my code:
    CachedRowSet TargetTableCursor= new CachedRowSetImpl();
    ...I populate the cursor...
    ...I update the cursor
    ...I retrieve the connection con accros a poolconnection object
    ...I update to the Database with the following istructions
    TargetTableCursor.acceptChanges(con);
    con.close();
    at this point, the object con (the connection) it does not come destroyed.
    someone has an idea about this?
    thanks
    Emiliano

    Hi,
    It looks like you have some "wrong" concepts.
    First you say that:
    <b>Now in WS1, there is no schema</b>
    later on you are telling
    <b>have then check the command
    select * from SAPBOS.SVERS and it worked.</b>
    So, do you have a schema or don't you?
    Let me try to understand what you have done, for your description
    1) you have a system called BOS. On this system you have a schema called SAPBOS.
    2) you did a system copy from BOS to W1S. Guessing -> You did a restore from a BOS
    Now your SAPW1S has "dissapeared"
    am I understandin it properly?
    If so, you should think a little.
    You have restored a backup from BOS ( DB name BOS, SCHEMA BOS, tablespace names PSAPBOS ) into W1S
    Restoring a backup will not change the schema name ( AFAIK, there is no simple way of doing so )
    Restoring a backup will not change the tablespaces names ( in Oracle 10g you can do this, but has to be done manually )
    Restoring the backup will not change the DB name. The System copy procedure ask you to create a script that will perform this last change.
    So, at the end of the process you have a DB called W1S, with a schema called SAPBOS and tablespaces called PSAPBOS.
    As mentioned before there is no simple way of changing the schema name.
    If you <b>need/want/desire</b> to do so then you cannot use BACKUP/RESTORE for system copies. You must use the R3Load method ( take all data out of the DB and then take all the data in on the new system )

  • ROWSET taking too much time to populate

    Hi ,
    I have a problem with ROWSET.
    I have a table with 6 columns and approximately more than 200 records.
    I reterive them in a ResultSet and resultset gets populated.
    But when I populate Rowset with that ResultSet then it hangs for atleast 1 minuate and then it comes back to its original state.
    Can anyone have the idea why it happens....?
    Is there any issue with the Rowset ?
    Why it takes too much time to populate the rowset..?
    CachedRowSetImpl crs = new CachedRowSetImpl();
    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    ResultSet result = stmt.executeQuery(sql); // Here we have 250 records in ResultSet
    crs.populate(result); // This is the problem. This line takes atleast 1min to executeThanks
    Tariq

    I think this Java Forum is not the right FORUM for
    me.....I think you are right. This is NOT the FORUM for YOU.
    I think u (So Called GURUS) all need to work on JDBC
    more and on large application so that u should be
    able to solve complex problem.
    THIS is PROBABLY not the BEST way for YOU to get HELP
    I hope u will work on my suggestion...
    I HOPE you CHOKE on a TURNIP and DIE.
    Thx
    Muhammad TariqF&#117;ck you.
    On your way out please make sure to stop in at Google and search for "Forums for arrogant fuckwits". That's the kind of resource you need.

  • Unable to execute sql

    Hi , i am getting the following error while creating a table. using weblogic 8.1.
    i am able to execute the sql from sqlplusw.
    following is the stack trace :
    Table Query ==> CREATE TABLE TMP451956Table ( YTM VARCHAR (15), AGE VARCHAR
    (15), PREMIUM VARCHAR2 (15), CONTRIBUTION_CHARGE VARCHAR2 (15), SERVICE_TAX VARC
    HAR2 (15), AMOUNT_INVEST VARCHAR2 (15), FUND_MGT_CHARGE6 VARCHAR2 (15),FUND_MGT_
    CHARGE10 VARCHAR2 (15),MORTALITY_CHARGE6 VARCHAR2 (15),MORTALITY_CHARGE10 VARCHA
    R2 (15),SARC VARCHAR2 (15),ADB_RIDER VARCHAR2 (15),CI_RIDER VARCHAR2 (15),ADD_ST
    6 VARCHAR2 (15),ADD_ST10 VARCHAR2 (15),FUND_VALUE_AT_START VARCHAR2 (15),ADMIN_C
    HARGE VARCHAR2 (15),FUND_AT_YEAR_END VARCHAR2 (15),FUND_VALUE_AT_START10 VARCHAR
    2 (15),FUND_AT_YEAR_END10 VARCHAR2 (15))
    java.sql.SQLException: ORA-01003: no statement parsed
    at oracle.jdbc.driver.DatabaseError.throwSqlException(Ljava/lang/String;
    Ljava/lang/String;I)V(DatabaseError.java:125)
    at oracle.jdbc.driver.T4CTTIoer.processError(Z)V(T4CTTIoer.java:305)
    at oracle.jdbc.driver.T4CTTIoer.processError()V(T4CTTIoer.java:272)
    at oracle.jdbc.driver.T4C8Odscrarr.receive([Loracle/jdbc/driver/Accessor
    ;)[Loracle/jdbc/driver/Accessor;(T4C8Odscrarr.java:206)
    at oracle.jdbc.driver.T4CPreparedStatement.do_describe(Z)V(T4CPreparedSt
    atement.java:444)
    at oracle.jdbc.driver.OracleStatement.describe()V(OracleStatement.java:3
    220)
    at oracle.jdbc.driver.OracleResultSetMetaData.<init>(Loracle/jdbc/driver
    /PhysicalConnection;Loracle/jdbc/driver/OracleStatement;)V(OracleResultSetMetaDa
    ta.java:63)
    at oracle.jdbc.driver.OracleResultSetImpl.getMetaData()Ljava/sql/ResultS
    etMetaData;(OracleResultSetImpl.java:133)
    at weblogic.jdbc.wrapper.ResultSet.getMetaData()Ljava/sql/ResultSetMetaD
    ata;(ResultSet.java:185)
    at com.sun.rowset.CachedRowSetImpl.populate(Ljava/sql/ResultSet;)V(Unkno
    wn Source)
    at com.db.DBHandler1.executeQuery(Ljava/lang/String;)Ljavax/sql/rowset/C
    achedRowSet;(DBHandler1.java:436)
    at com.arionsystems.bi.UnitPlusSmartUlip.execute(Lorg/apache/struts/acti
    on/ActionMapping;Lorg/apache/struts/action/ActionForm;Ljavax/servlet/http/HttpSe
    rvletRequest;Ljavax/servlet/http/HttpServletResponse;)Lorg/apache/struts/action/
    ActionForward;(UnitPlusSmartUlip.java:256)
    at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(Lorg/a
    pache/struts/chain/contexts/ActionContext;Lorg/apache/struts/action/Action;Lorg/
    apache/struts/config/ActionConfig;Lorg/apache/struts/action/ActionForm;)Lorg/apa
    che/struts/config/ForwardConfig;(ExecuteAction.java:58)
    at org.apache.struts.chain.commands.AbstractExecuteAction.execute(Lorg/a
    pache/struts/chain/contexts/ActionContext;)Z(AbstractExecuteAction.java:67)
    at org.apache.struts.chain.commands.ActionCommandBase.execute(Lorg/apach
    e/commons/chain/Context;)Z(ActionCommandBase.java:51)
    at org.apache.commons.chain.impl.ChainBase.execute(Lorg/apache/commons/c
    hain/Context;)Z(ChainBase.java:190)
    at org.apache.commons.chain.generic.LookupCommand.execute(Lorg/apache/co
    mmons/chain/Context;)Z(LookupCommand.java:304)
    at org.apache.commons.chain.impl.ChainBase.execute(Lorg/apache/commons/c
    hain/Context;)Z(ChainBase.java:190)
    at org.apache.struts.chain.ComposableRequestProcessor.process(Ljavax/ser
    vlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V(Composab
    leRequestProcessor.java:283)
    at org.apache.struts.action.ActionServlet.process(Ljavax/servlet/http/Ht
    tpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V(ActionServlet.java:1
    913)
    at org.apache.struts.action.ActionServlet.doGet(Ljavax/servlet/http/Http
    ServletRequest;Ljavax/servlet/http/HttpServletResponse;)V(ActionServlet.java:449
    at javax.servlet.http.HttpServlet.service(Ljavax/servlet/http/HttpServle
    tRequest;Ljavax/servlet/http/HttpServletResponse;)V(Optimized Method)
    at javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;
    Ljavax/servlet/ServletResponse;)V(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
    ()Ljava/lang/Object;(Optimized Method)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax/servle
    t/ServletRequest;Ljavax/servlet/ServletResponse;Lweblogic/servlet/internal/Filte
    rChainImpl;)V(Optimized Method)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax/servle
    t/ServletRequest;Ljavax/servlet/ServletResponse;)V(Optimized Method)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run()Ljava/lang/Object;(Optimized Method)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic/se
    curity/subject/AbstractSubject;Ljava/security/PrivilegedAction;)Ljava/lang/Objec
    t;(Optimized Method)
    at weblogic.security.service.SecurityManager.runAs(Lweblogic/security/ac
    l/internal/AuthenticatedSubject;Lweblogic/security/acl/internal/AuthenticatedSub
    ject;Ljava/security/PrivilegedAction;)Ljava/lang/Object;(Optimized Method)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogi
    c/servlet/internal/ServletRequestImpl;Lweblogic/servlet/internal/ServletResponse
    Impl;)V(Optimized Method)
    at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic/kernel
    /ExecuteThread;)V(Optimized Method)
    at weblogic.kernel.ExecuteThread.execute(Lweblogic/kernel/ExecuteRequest
    ;)V(Optimized Method)
    Error Occured While creating the temp tablejava.sql.SQLException:
    Help will be highly appreciated, thanks
    Edited by: newbie123 on Mar 7, 2009 11:31 PM

    From the stack trace you have provided, you are using executeQuery(String query) method to create the table.
    As per JDBC Specification, executeQuery(String query) method is designed for SELECT statement and it will return a single resultset.
    The method executeUpdate(String query) is designed to execute INSERT,UPDATE,DELETE statements and also CREATE,DROP,ALTER(DDL Commands) statements.The return value of the executeUpdate(String query) is an integer that indicates the number of rows that were affected.For statements like CREATE/ALTER/DROP which doesn't have any affected rows , will return zero.
    In this case, try to create the table , using executeUpdate(String query) method.

  • Invalid Cursor Position Error on Windows XP using CachedRowSet

    Hello, I don't know if this question lies here, but I thought it would be the well suited place so please pardon me if it isn't. I am trying to access multiple pages from my database on my XP machine but I am getting an "invalid cursor position" error when trying to access the next page. I don't know how this error is coming about because it works well on a Vista machine with no errors. I don't know if it is my drivers or something that brings about the problem. I am using mysql connecter 5.1.10, JRE 1.6.0_02 and windows XP SP2
    Below is a simple code that brings the error.
    package Admin; import javax.sql.rowset.CachedRowSet; import com.sun.rowset.CachedRowSetImpl; public class test { public void table() { try { CachedRowSet crs=new CachedRowSetImpl(); crs.setUrl("jdbc:mysql://host:3306/database");         crs.setUsername("User");         crs.setPassword("password"); crs.setCommand("select * from myTable"); int[] keys = {1}; crs.setKeyColumns(keys); crs.execute(); crs.last(); if(crs.getRow()>500){ //new overLimit(); } crs.setPageSize(3); crs.execute(); while (crs.next()) { System.out.print("page one----"); System.out.println(crs.getString(1)); } while(crs.nextPage()){ System.out.println("page two---"); while (crs.next()) { System.out.println("in page two"); System.out.println(crs.getString(1)); } } } catch (Exception e) { e.printStackTrace(); } } public static void main(String []args){ new test().table(); } }

    Yes I am running the same code on both machines. The output I get on the XP machine is shown below. I modified the code I posted earlier and replaced the "page two" text with "page (then page number)" and also omitted the "in page two" text for better readability---------PAGE 0---------
    DB09140110
    DU35463010
    EX29201810
    ---------PAGE 1---------
    EX38341510
    EX40471810
    KZ280299
    ----------PAGE 2---------
    LA130299
    LC130299
    MC081009
    ----------PAGE 3---------
    RZ300502
    VA130299
    VI020209
    ----------PAGE 4---------
    YX101008
    ZE220299
    ZF231105and vista....
    ----------PAGE 0---------
    EX38341510
    EX40471810
    KZ280299
    ----------PAGE 1---------
    LA130299
    LC130299
    MC081009
    ----------PAGE 2---------
    RZ300502
    VA130299
    VI020209
    ----------PAGE 3---------
    YX101008
    ZE220299
    ZF231105

  • Command Link inside of datatable

    I have the following problem when I put a command link inside a datatable.
    The action or actionlisteners never get called. Now here is the funny thing.
    1. If I move the action link outside the datatable it works.
    2. if I change the scope of the bean to session it works
    3. if the datatable contains more than 1 row it works
    The last one tells me this is a bug.
    To test this I change the sql query to limit the result so 1 row would be returned.
    The sql query returns a CachedRowSetImpl
    I believe this is a bug.
    <h:dataTable rows="6" first="0" id="table" binding="#{event.eventdata}" value="#{event.eventdetails}" var="eventdetail">
    <h:column>
    <h:commandLink value="#{eventdetail.title}" action="#{event.resaveEventaction}" actionListener="#{event.resaveEventdetails}" id="test" >
    </h:commandLink>     
    </h:column>
    <h:column>
    </h:dataTable>

    Here is some additional information that makes this more confusing.
    The following code is used to populate the datatable
    public CachedRowSetImpl getEventdetails(){
         CachedRowSetImpl rs2 = null;
         String selectedeventmy = selectedevent;
         int rowcount = 0;
         try { 
              sql = "SELECT * FROM event where eventid='"+selectedeventmy+"' ";
              rs2 = RunQuery.mysql(sql);
              rowcount = rs2.size();
         } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
         return rs2;
    where RunQuery.mysql is
    public class RunQuery {
         public static CachedRowSetImpl mysql(String sql) throws Exception {
              CachedRowSetImpl crset = null;
              InitialContext initCtx = new InitialContext();
              Context envCtx = (Context) initCtx.lookup("java:comp/env");
              try {
                   DataSource ds = (DataSource) envCtx.lookup("jdbc/associations");
                   Connection conn = null;
         Statement stmt = null;
         conn = ds.getConnection();
         stmt = conn.createStatement();
         stmt.execute(sql);
         ResultSet rs = stmt.getResultSet();
         crset = new CachedRowSetImpl();
         crset.populate(rs);
         rs.close();
         stmt.close();
         conn.close();
              } catch (Exception e) {
                   System.out.println(e.getMessage());
              return crset;
    if I replace the line
    String selectedeventmy = selectedevent;
    with String selectedeventmy = "61";
    it works properly.
    selectedevent is populated from the following triggered by another action event on another page. ? The funny thing is if the result set returns more that 1 row all works ok.
    public String viewDetails(){
         System.out.println("Running view Details");
         int selectedrow = eventlist.getRowIndex();
         Object selected = eventlist.getRowData();
         Map rowdata = (Map) selected;
         selectedevent = rowdata.get("eventid").toString();
         System.out.println("Selected Event:"+selectedevent);
         outcome="eventdetails";
         return outcome;
    }

Maybe you are looking for