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

Similar Messages

  • 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. :)

  • 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)

  • 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.

  • Rowset.jar nightmare, where do i find the latest?

    I continue to be haunted by ClassCastException whenever i try getDate(). I've seen threads that say it was fixed, but the latest rowset.jar I found on this site version 1_0_1 still has the bug.
    I'm now being forced to download j2se 1.5 and dig through it to see if I can find the rowset.jar in there and maybe just maybe it will solve all my problems.
    Has anyone else resolved this problem?

    That's great but after installing tiger (1.5) I can't
    even compile my classes because my ide Jbuiler X
    doesn't support it. Neither will my app server. So, my
    question is why doesn't sun provide the lastest
    rowset.jar on their website that is incorporated into
    tiger? Why continue to allow people to download the
    rowset implentation 1_0_1 that has bugs?If you give Sun enough money they will be more than willing to fix it for you.
    Otherwise you live with what you get.
    >
    Should developers attempt to use CachedRowSetImpl, or
    are we just wasting our time?No idea about developers in general, but I have never used them.

  • 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

  • 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

  • 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

  • CachedRowSet using DataSource

    Has anyone else had this problem.
    This piece of code works fine:
    RowSet rs = new JdbcRowSetImpl();
    rs.setDataSourceName("java:/comp/env/jdbc/ChemNetDB");
    rs.setCommand("Select * from TBL_DISPLAY_FIELDS where DEFAULT_FIELD=1");
    rs.execute();
    this one doesn't
    RowSet rs = new CachedRowSetImpl();
    rs.setDataSourceName("java:/comp/env/jdbc/ChemNetDB");
    rs.setCommand("Select * from TBL_DISPLAY_FIELDS where DEFAULT_FIELD=1");
    rs.execute();
    It give this error:
    java.sql.SQLException: The url cannot be null
         java.sql.DriverManager.getConnection(DriverManager.java:489)
         java.sql.DriverManager.getConnection(DriverManager.java:171)
         com.sun.rowset.CachedRowSetImpl.execute(CachedRowSetImpl.java:735)
         com.sun.rowset.CachedRowSetImpl.execute(CachedRowSetImpl.java:1360)
         org.apache.jsp.Search_jsp._jspService(Search_jsp.java:98)
    Is this a bug. I haven't seen anyone else have this problem. I'm using tomcat 5.
    Thanks,
    Peter

    I've got the same probs you do (using the datasource name doesn't do any good at all, keeps throwing a "URL cannot be null" exception. For interest sake, this is using the latest postgresql driver, compiled under 1.5).
    Here's a workaround that seems to work fine, however:
              //get the initial context, which is used to authenticate the user against the database
              DataSource ds = null;
              if (ctx == null) {
                   try {
                        ctx = new InitialContext();
                        ds = (DataSource)ctx.lookup("java:comp/env/jdbc/myDS");
                   } catch (Exception e) {
                        throw new ServletException(e);
              //authenticate the user
              try {
                   CachedRowSetImpl rs = new CachedRowSetImpl();
                   rs.setCommand("select count(1) from some_table");
                   rs.execute(ds.getConnection());
              } catch (Exception e) {
                   throw new ServletException(e);
    The juice here, of course, is that by passing the connection into the rs.execute command I bypass whatever bug the CachedRowSetImpl has, and I get to reuse my pooled database connections

  • How can I use a public variable inside a CachedResultSet

    The public variable that I declared cannot be called inside the CachedResultSet class....
    Heres a part of the code:
         public String type;
         public String getType()
             return type;
         public void setType(String s)
             type = s;
         public CachedRowSet first_report(){
              try {
              String t=type;<<it cannot get the String type declared outside.....     
              Statement stmt = con.createStatement();
              String query = "select stock_code, shares_prices, new_shares, trans_date, prev_close from allTrans where name_broker='"+type+"' order by stock_code";
              ResultSet rs = stmt.executeQuery(query);
                CachedRowSetImpl crset = new CachedRowSetImpl();
                crset.populate(rs);
              rs.close();
              stmt.close();
              con.close();
              return crset;
               catch (Exception e)
              {   System.out.println(e.getMessage());
                  return null;
         }

    I am not getting any error but the value of String type is null when entering the CachedRowSet...I don't know why it is null and yet the String type can be used by other classes...Like the getType...
    Heres the code:
    import java.sql.*;
    import sun.jdbc.rowset.*;
    import com.sun.rowset.*;
    import javax.sql.rowset.CachedRowSet;
    public class views
          String url, uname, pwd;
          Connection con;
         public String type;
          public String hstock;
          public String hbroker;
         public String getType()
         {  System.out.println("get:"+type);
             return type;
              public void setType(String s)
             type = s;
         public views()
               try
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               url = "jdbc:odbc:***";
               uname = "root";
               pwd = "yes";
               con = DriverManager.getConnection(url, uname, pwd);
               } catch (Exception e)
                    System.out.println(e.getMessage());
    public CachedRowSet first_report(){
              try {
              String t=type;
                System.out.println(t);
                System.out.println(type);     
              Statement stmt = con.createStatement();
              String query = "select stock_code, shares_prices, new_shares, trans_date, prev_close from allTrans where name_broker='"+type+"' order by stock_code";
              ResultSet rs = stmt.executeQuery(query);
                CachedRowSetImpl crset = new CachedRowSetImpl();
                crset.populate(rs);
              rs.close();
              stmt.close();
              con.close();
              return crset;
               catch (Exception e)
              {   System.out.println(e.getMessage());
                  return null;
         }

  • 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

  • Using Creator with Cloudscape.

    Anyone managed to use the CLoudscape database with Creator on Linux yet?
    I have followed the advice in Lance Andersens blog
    http://weblogs.java.net/blog/lancea/archive/2004/11/using_apache_de.html
    and put derby.jar,derbynet.jar,db2jcc.jar,db2jcc_license_c.jar in /Creator/SunAppServer8/domains/creator/lib/ext
    and created a .tpersistence.properties file in /Creator/SunAppServer8/domains/creator/config
    I created a datasource as in the tutorial Creating Database Server Types and Data Sources. Testing the connection sometimes works and sometimes fails. Every attempt to use the Cloudscape database with a program created using Creator with the embedded driver gives the following error
    SQLException: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Failed to start database '/home/johlan/CSSystemHome/testDB'.
    Trying to create a datasource for a network connection seems impossible as testing the connection gives the message
    wrong driver:com.ibm.db2.jcc.DB2Driver but this is the correct driver.
    Thanks in advance for any suggestions on how to get Creator to use the Cloudscape database.

    Thanks for the reply. I had looked at that thread while trying to get a connection before.
    What I have found is that using the normal Creator procedure of dragging a table onto the jsp page to produce a datasource and rowsets does not produce a working connection to Cloudscape as it does with Pointbase. I also wanted to use CachedRowSets, which does not seem easy in Creator.
    I have found I can connect to databases using the Cloudscape network server with connections made using DriverManager. Even so while I can read from the database using ResultSet and CachedRowSet these fail when trying to write to the database. Writing to the database from Creator produced web pages can only be done using Statements.
    As Cloudscape is written in Java I would have thought it worthwhile for the Creator team to make it easier for developers to use it with Creator.
    A quick working example is listed below. Any improvements welcomed. Don't forget to start the network server.
    John.
    package nodsattainnet;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import com.sun.rowset.CachedRowSetImpl;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.GregorianCalendar;
    import javax.faces.component.html.*;
    import javax.sql.rowset.CachedRowSet;
    public class Page1 extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
        public void setForm1(HtmlForm hf) {
            this.form1 = hf;
        private HtmlOutputText outputText1 = new HtmlOutputText();
        public HtmlOutputText getOutputText1() {
            return outputText1;
        public void setOutputText1(HtmlOutputText hot) {
            this.outputText1 = hot;
        private HtmlCommandButton button1 = new HtmlCommandButton();
        public HtmlCommandButton getButton1() {
            return button1;
        public void setButton1(HtmlCommandButton hcb) {
            this.button1 = hcb;
        private HtmlOutputText outputText2 = new HtmlOutputText();
        public HtmlOutputText getOutputText2() {
            return outputText2;
        public void setOutputText2(HtmlOutputText hot) {
            this.outputText2 = hot;
        private HtmlCommandButton button2 = new HtmlCommandButton();
        public HtmlCommandButton getButton2() {
            return button2;
        public void setButton2(HtmlCommandButton hcb) {
            this.button2 = hcb;
        private HtmlMessages messageList1 = new HtmlMessages();
        public HtmlMessages getMessageList1() {
            return messageList1;
        public void setMessageList1(HtmlMessages hm) {
            this.messageList1 = hm;
        // </editor-fold>
        //database is located in /home/johlan/CSSystemHome
        private static String DBNAME = "mydb";
        //Cloudscape network server port
        private static int SERVER_PORT = 1527;
        //DB2 JDBC Universal Driver
        private static final String UNIVERSAL_DRIVER = "com.ibm.db2.jcc.DB2Driver";
        //URL to connect to Cloudscape network server using the DriverManager.
        private static final String CS_NS_DBURL = "jdbc:derby:net://localhost:"+SERVER_PORT+"/"
        +DBNAME+";retrieveMessagesFromServerOnGetMessage=true;deferPrepares=true;";
        //the username
        private static final String username = "myusername";
        //the password
        private static final String password = "mypassword";
        // </editor-fold>
        public Page1() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
            } catch (Exception e) {
                log("Page1 Initialization Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
        protected nodsattainnet.SessionBean1 getSessionBean1() {
            return (nodsattainnet.SessionBean1)getBean("SessionBean1");
        protected nodsattainnet.ApplicationBean1 getApplicationBean1() {
            return (nodsattainnet.ApplicationBean1)getBean("ApplicationBean1");
         * Bean cleanup.
        protected void afterRenderResponse() {
        public String button1_action() {
            // TODO Replace with your code
            Statement stmt = null;
            Connection conn = null;
            ResultSet rs = null;
            CachedRowSet crs;
            try {
                Class.forName(UNIVERSAL_DRIVER).newInstance();
                conn = java.sql.DriverManager.getConnection(CS_NS_DBURL,username, password);
                crs = new CachedRowSetImpl();
                try {
                    stmt = conn.createStatement();
                    String command = "SELECT lastname from users WHERE user_id = 1";
                    rs = stmt.executeQuery(command);
                    crs.populate(rs);
                finally {
                    rs.close();
                    conn.close();
                crs.first();
                outputText2.setValue(crs.getString("lastname"));
            catch (SQLException se) {
                // log error
                error("SQLException: " + se);
                log("Get Lastname SQLException: " + se);
            catch (ClassNotFoundException cnfe) {
                error("cnfe: " + cnfe);
                cnfe.printStackTrace();
            catch (InstantiationException ie) {
                error("ie: " + ie);
                ie.printStackTrace();
            catch (IllegalAccessException iae) {
                // log error
                error("IllegalAccessException: " + iae);
                log("Get Lastname IAException: " + iae);
            return null;
        public String button2_action() {
            // TODO Replace with your code
            Statement stmt = null;
            Connection conn = null;
            try {
                Class.forName(UNIVERSAL_DRIVER).newInstance();
                conn = java.sql.DriverManager.getConnection(CS_NS_DBURL,username, password);
                try {
                    PreparedStatement ps = conn.prepareStatement("INSERT INTO answers VALUES(?,?,?,?,?)");
                    ps.setInt(1, 2);
                    ps.setInt(2, 3);
                    ps.setInt(3, 4);
                    ps.setString(4, "MYAN");
                    ps.setDate(5, new java.sql.Date((new java.util.GregorianCalendar()).getTimeInMillis()));
                    ps.executeUpdate();
                finally {
                    conn.close();
            catch (SQLException se) {
                // log error
                error("SQLException: " + se);
                log("Answer Insert SQLException: " + se);
            catch (ClassNotFoundException cnfe) {
                error("cnfe: " + cnfe);
                cnfe.printStackTrace();
            catch (InstantiationException ie) {
                error("ie: " + ie);
                ie.printStackTrace();
            catch (IllegalAccessException iae) {
                // log error
                error("IllegalAccessException: " + iae);
                log("Get Lastname IAException: " + iae);
            return null;
    }

  • 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 )

  • CachedRowSet Use

    Hi All,
    I am using jdbc-odbc connection to connect to sql2000 server. I am able to read the data and polpulate the CachedRowset also. When i am using cachedrowset.next() its displaying all the rows but when i use while(cachedrowset.nextPage()){
        while(cachredrowset.next()){ System.out.println(row);}
    } its giving me following exception java.sql.SQLException: Populate data before calling
            at com.sun.rowset.CachedRowSetImpl.nextPage(Unknown Source)
            at CachedRowSetSampl.main(CachedRowSetSampl.java:88)When i try to use cachedrowset.populate(rs,10) its giving me following exception:
    java.sql.SQLException: Result set type is TYPE_FORWARD_ONLY
            at sun.jdbc.odbc.JdbcOdbcResultSet.absolute(JdbcOdbcResultSet.java:2434)I am totally new to CahcedRowSet use. I tried setting property cachedrowset.setType(ResultSet.TYPE_SCROLL_INSENSITIVE) but it didn't help. Please help me.

    You're probably more likely to find JDBC gurus on the JDBC forum - http://forum.java.sun.com/forum.jspa?forumID=48

  • How do I use Edge Web Fonts with Muse?

    How do I use Edge Web Fonts with Muse - is it an update to load, a stand alone, how does it interface with Muse? I've updated to CC but have no info on this.

    Hello,
    Is there a reason why you want to use Edge Web Fonts with Adobe Muse?
    Assuming you wish to improve typography of your web pages, you should know that Muse is fully integrated with Typekit. This allows you to access and apply over 500 web fonts from within Muse. Here's how you do it:
    Select a text component within Muse, and click the Text drop-down.
    Select Add Web Fonts option, to pop-open the Add Web Fonts dialog.
    Browse and apply fonts per your design needs.
    Muse also allows you to create paragraph styles that you can save and apply to chunks of text, a la InDesign. Watch this video for more information: http://tv.adobe.com/watch/muse-feature-tour/using-typekit-with-adobe-muse/
    Also take a look at these help files to see if they help you:
    http://helpx.adobe.com/muse/tutorials/typography-muse-part-1.html
    http://helpx.adobe.com/muse/tutorials/typography-muse-part-2.html
    http://helpx.adobe.com/muse/tutorials/typography-muse-part-3.html
    Hope this helps!
    Regards,
    Suhas Yogin

Maybe you are looking for

  • HP Officejet 4620 won't copy or scan but will print

    My HP Officejet 4620 all in one printer won't copy or scan, but it will print.  When trying to scan, my computer first shows a window "preparing to scan" then it changes to a window "scanner unreachable".  When trying to copy the printer indicates "n

  • Problems with Flash Line Graphs

    I have two problems with the new Flash Line Graphs in APEX 3.1 1. I have created a query that returns a set number of rows. Sometimes the VALUE for a specific row might be null. When this occurs the LABEL data does not show up on the X axis. I want t

  • How to connect database(oracle 10g) and retreive values using poral 10

    can anyone help me how to connect to database and retreive values in detail and also please post the sample code if u have any.

  • Using reflection in EJBs

    I'm a little unclear as to what the spec says about reflection, and I was hoping someone would be able to clarify it. Section 18.1 of the spec reads: "* The enterprise bean must not attempt to query a class to obtain information about the declared me

  • PHP/MySQL search record

    Hi, I have a form where a user will enter their desired user name and their e-mail address. Once I see that both fields are filled in, I need to check to see if the username and/or e-mail address they entered are already in the database. The table is