Cached resultset

i'm buliding a web page that navigate a database. how can i make my page not to connect every time i click on a button. how can i used cachedrowset.

Use ViewHelper design pattern

Similar Messages

  • JPA caching ResultSets

    I am experiencing something that make me wonder at JPA.
    I write a class that updates the status of a record and immediately query the table for a list that should contain the new updated query, but the list doesn't contain the record.
    Secondly, I use a scheduler to update a table and use a reference to obtain my new status, it throws NoResultException.
    So, I am asking how does the caching before in JPA supposed to work?
    Is it configurable?
    Can I remove it completely?
    is the JPA implementation specific? That means it Hibernate going to differ from Toplinks in caching behaviour
    Please, answers to these question will improve my understanding of this.
    Regards
    Michael

    Greetings Dvohra,
    Thank you for you reply, but I have notes Eclipselink manual covers NamedQueries and Queries only in the cache paragraph (I have no direct link right now to this material). Also here are no proofs of that kind Eclipselink could catch calling stored procedures of deleting database records and to make changes in cache needed like
    # delete from goods where id > 3 and id < 112;
    call delete_goods(3,112);Greetings Konstantin,
    Thank you for you reply - I have posted to Eclipse forum, but I still have no luck to get answers.
    Best regards,

  • Entity-Named Query Caching - Need live results from DB not Cached

    I've developed an application EJB3 web application which uses Entity Beans and NamedQueries to retrieve my results.
    Aswell as my main EJB3 web application I also have an external interface (Oracle Stored Procedure) which is updating data in my database tables. The problem is that the when the NamedQueries are called they only bring back "Cached" resultsets and not the live results that exists in the database at that time. If my Stored Procedure updates a value (or if I update a value via Toad for testing) the NamedQuery does not bring back these changes. From what I have read about NamedQueries it seems that they do actually query the live db but send back the cached values for performance reasons.
    Is there a way to turn off caching of Query results?
    If not is there another way to deal with this issue?
    ps. I'm using Jdev 10.1.3.4 and appserver 10.1.3.1

    Anyone?

  • WLS9.2 caching results of CallableStatement?

    Hello All,
    I've been flummoxed by a problem in which the results of a CallableStatement seem to be cached by our WebLogic 9.2 server. We have a connection pooled DataSource talking to Oracle8i (8.1.7.4.0), configured with 10 statements in a cache and the LRU algorithm, also 1 connection initially and a maximum of 15. We're using Oracle's ojdbc14.jar implementation and orai18n.jar.
    We're mostly executing CallableStatments for packaged procedures/functions that in turn call other procedures or run selects. What I'm geting at is, we're retrieving data rather than updating through our CallableStatement. The retreieved data we extract from the returned oracle ARRAY type using a homegrown map to the "shape" of each Struct underlying the ARRAY collection. In this problem, two CallableStatements are run and return data to our Java app, and at the start all is well. Then the underlying data is changed - via procedures in an oracle forms app on the database, not our Java app. Our Java app should display the changed data. The first CallableStatement runs again and an Eclipse remote debug shows the updated data, however the second CallableStatement continues to return the older data. We have oracle test harnesses that call the same procedures as our CallableStatements; both return the new data. If we leave it for sometime less than 45 minutes, the new data is then returned by both statements. Similarly, if we set the statement cache size to 0, the newe data is returned both times. We're closing the DB resources, (and in the right order: ResultSet, Statement and Connection)
    Has anyone come across this issue before? (From my searches it appears not). Secondly, is there a way of debugging into the WLS DataSource mechanism? I can go down as far as getting the ARRAY and no further, but if there's a switch/command line arg that I could use in the startWeblogic script that'd be great. I remember reading about a WebLogic attributeSpy, (or maybe spyAttribute?) and if I had to try the WLS driver for that I'd give it a go, but if Oracle have something similar that'd be fantastic.
    FWIW, changing the data via the oracle forms app changes the sysdate on the oracle database too.
    Variables from the debug that might be relevant:
    DataSource retrieved from jndi context of type WLEventContextImpl
    driversettings
    weblogic.jdbc.rmi.internal.RmiDriverSettings{verbose=false chunkSize=256 rowCacheSize=0}
    driverProps entrySet [EmulateTwoPhaseCommit=false, connectionPoolID=xxxxx, jdbcTxDataSource=true, LoggingLastResource=false, dataSourceName=xxxxx]
    Connection is PoolConnection_oracle_jdbc_driver_T4CConnection
    weblogic.jdbc.wrapper.PoolConnection_oracle_jdbc_driver_T4CConnection@5f1
    statement     is CallableStatement_oracle_jdbc_driver_T4CCallableStatement (id=nnnnn)     
    weblogic.jdbc.wrapper.CallableStatement_oracle_jdbc_driver_T4CCallableStatement@5f2
    There is a StatementHolder too:
    weblogic.jdbc.wrapper.CallableStatement_oracle_jdbc_driver_T4CCallableStatement@5f2=weblogic.jdbc.common.internal.StatementHolder@21cae26
    In the "stmts" table in "conn" in "stmt", there are the following two variables:
    jstmt     T4CCallableStatement (id=nnnnn) oracle.jdbc.driver.T4CCallableStatement@21cad44
    key     StatementCacheKey (id=nnnn)     { call my_pack_name.my_proc_name(?,?)}:true:-1:-1
    Thanks for any help that anyone might be able to shed on this!
    Best Regards,
    ConorD

    Hi Joe,
    Thanks for your reply; I'm delighted to see that you're still here helping WLS users under the Oracle banner :-)
    To answer your question, yes, we do get good behaviour when we set the statement cache size to 0. I ran a test on that where I set the Statement cache size to 0 and the initial number of connections to 0, then:
    *1)* Logged in through our Java/WLS app to a few test scenarios and saw the data
    *2)* Ran the oracle app on that DB outside of WLS which moved forward the state of the app, including sysdate
    *3)* Logged in again through our Java/WLS app to the test scenarios and saw the new data being returned from both CallableStatements
    I don't think that the initial number of connections had any effect on this, since WLS was running all the time and there was no retargetting of the DataSource, so IMHO it must have been the statement cache size.
    Where we hadn't got the Statement cache size 0, for step *3)* above one of the two CallableStatements continued to return the old data, (as if it had been told by the DB that the result hadn't changed, and it might as well return a cached result - if WLS does cache ResultSets?)
    Lastly, there is one case where we do see good behaviour even with a Statement cache size of 10:
    Between steps *2)* and *3)* above, if I untarget & activate, then retarget & activate the DataSource (to the same server/db that had just been untargetted) we see new data back from both statements on running step *3)*, even with the Statement cache size set to 10. My guess is that the untarget frees up any object in the Statement cache for collection and removes the remote DB session stubs that may be caching on the DB side.
    Thanks again and Best Regards,
    ConorD

  • NamedQuery Results are Cached - I Need to retrieve live database results

    I've developed an application EJB3 web application which uses Entity Beans and NamedQueries to retrieve my results.
    Aswell as my main EJB3 web application I also have an external interface (Oracle Stored Procedure) which is updating data in my database tables. The problem is that the when the NamedQueries are called they only bring back "Cached" resultsets and not the live results that exists in the database at that time. If my Stored Procedure updates a value (or if I update a value via Toad for testing) the NamedQuery does not bring back these changes. From what I have read about NamedQueries it seems that they do actually query the live db but send back the cached values for performance reasons.
    Is there a way to turn off caching of Query results?
    If not is there another way to deal with this issue?
    ps. I'm using Jdev 10.1.3.4 and appserver 10.1.3.1
    Edited by: darkBubble on 15-May-2009 07:33

    I've posted this within the oc4j forum. Admin please remove this thread.

  • Why I have the problem about "terminateConnection()"

    When I want to destruct my class, there is an error occured for "Segmentation fault". My code is following:
    COMSDatabase::COMSDatabase(string strUser,string strPassword,string strSID)
         m_pEnv = Environment::createEnvironment (Environment::DEFAULT);
         m_pConn = m_pEnv->createConnection (strUser,strPassword,strSID);
         m_pConn->setStmtCacheSize(10);                         //10 is the num of Statement in the cache.          
    COMSDatabase::~COMSDatabase()
         m_pEnv->terminateConnection(m_pConn); //!!!!Error!!! Why????                    
    Environment::terminateEnvironment(m_pEnv);
    void COMSDatabase::GetJobRequest(char *&pszRequestID, char *&pszJobID, char &cRequestCommand, int &nProcessLevel)
         string sqlStmt = "SELECT REQUESTID,JOBID,REQUESTCOMMAND,PROCESS_LEVEL FROM OMSREQUEST ORDER BY PROCESS_LEVEL DESC, REQUESTCOMMAND ASC";
    m_pStmt = m_pConn->createStatement(sqlStmt,"queryOMSRequest");     //using Statement Caching
    ResultSet *pRset = m_pStmt->executeQuery ();        
    ResultSet::Status status = pRset->status();
    if (0!=status)
         try{
              if (pRset->next ())
                   string strRequestID = pRset->getString(1);     
                   const char *pszRequestIDTemp = strRequestID.c_str();                     
                   sprintf(pszRequestID,"%s",pszRequestIDTemp);
                   string strJobID = pRset->getString(2);
                   const char *pszJobIDTemp = strJobID.c_str();
                   sprintf(pszJobID,"%s",pszJobIDTemp);
         string strRequestCommandTemp = pRset->getString(3);
         const char *pszRequestCommandTemp = strRequestCommandTemp.c_str();
         cRequestCommand = pszRequestCommandTemp[0];
         nProcessLevel = pRset->getInt(4);     
              else
                   m_nErrorCode=1;
                   m_strErrMsg="No Job Request Command available now!" ;
         }catch(SQLException ex)
              m_nErrorCode=ex.getErrorCode();
              m_strErrMsg=ex.getMessage();
              m_pStmt->closeResultSet (pRset);
              return ;
         catch (exception &ex)
                   m_nErrorCode=-1;
              m_strErrMsg=ex.what();
              m_pStmt->closeResultSet (pRset);
              return ;
    m_pStmt->closeResultSet (pRset);
         m_pConn->terminateStatement (m_pStmt,"queryOMSRequest");
    return ;
    }

    I got it!

  • What is the difference between RESULTSET and a CACHE ROWSET

    hi all,
    can anybody tell me the difference between a RESULTSET and a CACHE ROWSET

    Sure! It's... on the javadocs :-)

  • New Records in database do not show up in resultset

    Hi,
    I have seen very little on this but I have a MS Access database that I have records in. If I change one of those records, I see the change in the resultset which I am just printing out for now using System.out.println . So I add new records manually to the database just so I am some records to test with and those records do not show up in the resultset. After doing something (not exactly sure what as I did a lot), I happen to go back and then saw the new records. So I add some more and could not see those records. I AM closing my resultsets, connections, etc. I read something where someone had the same problem and thought something was being cached which seemed reasonable to me. So I tried rebooting for the heck of it and I still see only the previous records and not the new ones.
    Any ideas,
    Thanks,
    Karl

    Hi Karl,
    There are problems some times like the one you mentioned when you are using both manual and programatic inserts/updates/deletes.
    When ever u face any such problems look out for following :
    Check if all ResultSet, Statement and Connection objects are closed before exiting the code. That is normal exit and abnormal exit (due to any error/exception).
    After manual insertion save and close target table.
    If the problem still exists then try re-compiling your code after closing the your Access (*.mdb) database.
    I hope this will work for you.
    regards,
    Humayun

  • Why does JDBC keep connections open even though I close the resultsets?

    I attached my program and my output. Please bear with me for the long output. My question here is why do the connections remain even though I closed the resultsets. I need to reuse my prepared statements, but don't want to keep the oracle sessions open. Is this possible? What do I need to do?
    If you notice in the program, I have executed the query to find the number of open sessions 5 times.
    1) After creating the connections
    2) After creating the prepared statements
    3) After executing them
    4) After getString on the resultSets
    5) After closing the resultsets.
    And the sessions are still there even is Step 5 :-(
    import java.sql.*;
    * Title:
    * Description:
    * Copyright: Copyright (c) 2001
    * Company:
    * @author
    * @version 1.0
    public class Test {
    String dburl = "jdbc:oracle:thin:@oracle92:1521:oracle92";
    String query = "select s.username,s.sid ,s.logon_time, s.serial#,sql.sql_text"+
    " from v$session s, v$sqltext sql where sql.address = "+
    "s.sql_address and sql.hash_value = s.sql_hash_value "+
    "and upper(s.username) like 'KRTEMP%'"+
    " order by s.username ,s.sid ,s.serial# ,sql.piece" ;
    // String query = "select s.username, s.sid ,s.logon_time, s.status from v$session s where upper(s.username) like 'KRTEMP%'";
    public Test(int num) throws Exception {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection[] con = new Connection[num];
    for(int i=0; i<num; i++) {
    con[i] = DriverManager.getConnection(dburl, "krtemp", "krtemp");
    executeQuery();
    PreparedStatement[] ps = new PreparedStatement[num];
    for(int i=0; i<num; i++) {
    ps[i] = con.prepareStatement("select * from contact");
    executeQuery();
    ResultSet[] rs = new ResultSet[num];
    for(int i=0; i<num; i++) {
    rs[i] = ps[i].executeQuery();
    executeQuery();
    for(int i=0; i<num; i++) {
    ResultSetMetaData meta = rs[i].getMetaData();
    while(rs[i].next()) {
    for(int j=1; j<=meta.getColumnCount(); j++) {
    rs[i].getString(j);
    executeQuery();
    for(int i=0; i<num; i++) {
    rs[i].close();
    executeQuery();
    private void executeQuery() throws Exception {
    Connection con = DriverManager.getConnection(dburl, "krtemp", "krtemp");
    PreparedStatement ps = con.prepareStatement(query);
    ResultSet rs = ps.executeQuery();
    ResultSetMetaData meta = rs.getMetaData();
    System.out.println("-----");
    while(rs.next()) {
    for(int i=1; i<=meta.getColumnCount(); i++) {
    System.out.print(rs.getString(i));
    System.out.print(" ");
    System.out.println();
    System.out.println("-----");
    public static void main(String[] args) throws Exception {
    Test test = new Test(5);
    The output is
    KRTEMP 9 2005-06-27 17:09:30.0 5436 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS WH
    ERE PARAMETER ='NLS_
    KRTEMP 9 2005-06-27 17:09:30.0 5436 DATE_FORMAT'
    KRTEMP 34 2005-06-26 18:51:01.0 3629 rename tstore to store
    KRTEMP 37 2005-06-27 17:09:25.0 4209 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 37 2005-06-27 17:09:25.0 4209 DATE_FORMAT'
    KRTEMP 74 2005-06-27 17:09:26.0 17625 select appId from profile_application_tabl
    e wher
    KRTEMP 74 2005-06-27 17:09:26.0 17625 e appName=:1 and appVersion=:2
    KRTEMP 83 2005-06-27 17:09:25.0 1771 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 83 2005-06-27 17:09:25.0 1771 DATE_FORMAT'
    KRTEMP 105 2005-06-27 17:09:30.0 3296 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 105 2005-06-27 17:09:30.0 3296 DATE_FORMAT'
    KRTEMP 111 2005-06-27 17:09:25.0 4878 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 111 2005-06-27 17:09:25.0 4878 DATE_FORMAT'
    KRTEMP 153 2005-06-27 17:09:30.0 31065 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 153 2005-06-27 17:09:30.0 31065 DATE_FORMAT'
    KRTEMP 163 2005-06-27 17:09:30.0 3205 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 163 2005-06-27 17:09:30.0 3205 DATE_FORMAT'
    KRTEMP 183 2005-06-27 17:09:30.0 3465 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 183 2005-06-27 17:09:30.0 3465 DATE_FORMAT'
    KRTEMP 191 2005-06-27 17:09:26.0 5438 select appId from profile_application_tabl
    e wher
    KRTEMP 191 2005-06-27 17:09:26.0 5438 e appName=:1 and appVersion=:2
    KRTEMP 256 2005-06-27 17:09:30.0 2718 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 256 2005-06-27 17:09:30.0 2718 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 256 2005-06-27 17:09:30.0 2718 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 256 2005-06-27 17:09:30.0 2718 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 9 2005-06-27 17:09:30.0 5436 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS WH
    ERE PARAMETER ='NLS_
    KRTEMP 9 2005-06-27 17:09:30.0 5436 DATE_FORMAT'
    KRTEMP 34 2005-06-26 18:51:01.0 3629 rename tstore to store
    KRTEMP 37 2005-06-27 17:09:25.0 4209 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 37 2005-06-27 17:09:25.0 4209 DATE_FORMAT'
    KRTEMP 74 2005-06-27 17:09:26.0 17625 select appId from profile_application_tabl
    e wher
    KRTEMP 74 2005-06-27 17:09:26.0 17625 e appName=:1 and appVersion=:2
    KRTEMP 83 2005-06-27 17:09:25.0 1771 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 83 2005-06-27 17:09:25.0 1771 DATE_FORMAT'
    KRTEMP 105 2005-06-27 17:09:30.0 3296 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 105 2005-06-27 17:09:30.0 3296 DATE_FORMAT'
    KRTEMP 111 2005-06-27 17:09:25.0 4878 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 111 2005-06-27 17:09:25.0 4878 DATE_FORMAT'
    KRTEMP 153 2005-06-27 17:09:30.0 31065 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 153 2005-06-27 17:09:30.0 31065 DATE_FORMAT'
    KRTEMP 163 2005-06-27 17:09:30.0 3205 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 163 2005-06-27 17:09:30.0 3205 DATE_FORMAT'
    KRTEMP 183 2005-06-27 17:09:30.0 3465 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 183 2005-06-27 17:09:30.0 3465 DATE_FORMAT'
    KRTEMP 191 2005-06-27 17:09:26.0 5438 select appId from profile_application_tabl
    e wher
    KRTEMP 191 2005-06-27 17:09:26.0 5438 e appName=:1 and appVersion=:2
    KRTEMP 232 2005-06-27 17:09:31.0 5893 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 232 2005-06-27 17:09:31.0 5893 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 232 2005-06-27 17:09:31.0 5893 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 232 2005-06-27 17:09:31.0 5893 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 34 2005-06-26 18:51:01.0 3629 rename tstore to store
    KRTEMP 37 2005-06-27 17:09:25.0 4209 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 37 2005-06-27 17:09:25.0 4209 DATE_FORMAT'
    KRTEMP 74 2005-06-27 17:09:26.0 17625 select appId from profile_application_tabl
    e wher
    KRTEMP 74 2005-06-27 17:09:26.0 17625 e appName=:1 and appVersion=:2
    KRTEMP 83 2005-06-27 17:09:25.0 1771 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 83 2005-06-27 17:09:25.0 1771 DATE_FORMAT'
    KRTEMP 111 2005-06-27 17:09:25.0 4878 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 111 2005-06-27 17:09:25.0 4878 DATE_FORMAT'
    KRTEMP 232 2005-06-27 17:09:31.0 5893 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 232 2005-06-27 17:09:31.0 5893 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 232 2005-06-27 17:09:31.0 5893 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 232 2005-06-27 17:09:31.0 5893 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 256 2005-06-27 17:09:31.0 2783 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 256 2005-06-27 17:09:31.0 2783 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 256 2005-06-27 17:09:31.0 2783 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 256 2005-06-27 17:09:31.0 2783 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 9 2005-06-27 17:09:30.0 5436 select * from contact
    KRTEMP 34 2005-06-26 18:51:01.0 3629 rename tstore to store
    KRTEMP 37 2005-06-27 17:09:25.0 4209 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 37 2005-06-27 17:09:25.0 4209 DATE_FORMAT'
    KRTEMP 74 2005-06-27 17:09:26.0 17625 select appId from profile_application_tabl
    e wher
    KRTEMP 74 2005-06-27 17:09:26.0 17625 e appName=:1 and appVersion=:2
    KRTEMP 83 2005-06-27 17:09:25.0 1771 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 83 2005-06-27 17:09:25.0 1771 DATE_FORMAT'
    KRTEMP 105 2005-06-27 17:09:30.0 3296 select * from contact
    KRTEMP 111 2005-06-27 17:09:25.0 4878 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 111 2005-06-27 17:09:25.0 4878 DATE_FORMAT'
    KRTEMP 153 2005-06-27 17:09:30.0 31065 select * from contact
    KRTEMP 163 2005-06-27 17:09:30.0 3205 select * from contact
    KRTEMP 173 2005-06-27 17:09:31.0 3922 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 173 2005-06-27 17:09:31.0 3922 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 173 2005-06-27 17:09:31.0 3922 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 173 2005-06-27 17:09:31.0 3922 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 183 2005-06-27 17:09:30.0 3465 select * from contact
    KRTEMP 191 2005-06-27 17:09:26.0 5438 select appId from profile_application_tabl
    e wher
    KRTEMP 191 2005-06-27 17:09:26.0 5438 e appName=:1 and appVersion=:2
    KRTEMP 232 2005-06-27 17:09:31.0 5893 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 232 2005-06-27 17:09:31.0 5893 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 232 2005-06-27 17:09:31.0 5893 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 232 2005-06-27 17:09:31.0 5893 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 256 2005-06-27 17:09:31.0 2783 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 256 2005-06-27 17:09:31.0 2783 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 256 2005-06-27 17:09:31.0 2783 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 256 2005-06-27 17:09:31.0 2783 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 9 2005-06-27 17:09:30.0 5436 select * from contact
    KRTEMP 34 2005-06-26 18:51:01.0 3629 rename tstore to store
    KRTEMP 37 2005-06-27 17:09:25.0 4209 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 37 2005-06-27 17:09:25.0 4209 DATE_FORMAT'
    KRTEMP 74 2005-06-27 17:09:26.0 17625 select appId from profile_application_tabl
    e wher
    KRTEMP 74 2005-06-27 17:09:26.0 17625 e appName=:1 and appVersion=:2
    KRTEMP 83 2005-06-27 17:09:25.0 1771 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 83 2005-06-27 17:09:25.0 1771 DATE_FORMAT'
    KRTEMP 105 2005-06-27 17:09:30.0 3296 select * from contact
    KRTEMP 111 2005-06-27 17:09:25.0 4878 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 111 2005-06-27 17:09:25.0 4878 DATE_FORMAT'
    KRTEMP 153 2005-06-27 17:09:30.0 31065 select * from contact
    KRTEMP 163 2005-06-27 17:09:30.0 3205 select * from contact
    KRTEMP 183 2005-06-27 17:09:30.0 3465 select * from contact
    KRTEMP 191 2005-06-27 17:09:26.0 5438 select appId from profile_application_tabl
    e wher
    KRTEMP 191 2005-06-27 17:09:26.0 5438 e appName=:1 and appVersion=:2
    KRTEMP 204 2005-06-27 17:09:32.0 1478 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 204 2005-06-27 17:09:32.0 1478 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 204 2005-06-27 17:09:32.0 1478 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 204 2005-06-27 17:09:32.0 1478 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 232 2005-06-27 17:09:31.0 5893 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 232 2005-06-27 17:09:31.0 5893 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 232 2005-06-27 17:09:31.0 5893 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 232 2005-06-27 17:09:31.0 5893 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 256 2005-06-27 17:09:31.0 2783 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 256 2005-06-27 17:09:31.0 2783 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 256 2005-06-27 17:09:31.0 2783 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 256 2005-06-27 17:09:31.0 2783 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece

    Why do the connections stay open? Because you haven't closed them.
    You answered your own question: obviously closing the ResultSet is NOT the same thing as closing the connection.
    When you do a query, you want to get the connection, statement, and result set, load the data from the result set into an object or data structure, and then immediately close them all again in reverse order of creation. You want to keep the scope as narrow as possible. You want to use a connection pool to keep the cost of obtaining a connection down. You should leave caching of the PreparedStatements to the JDBC driver.
    %

  • Wrapped: Unable to load class "com.cache.DBCacheStore"

    Hi,
    I was trying out a sample application for using DBCacheStore and getting the following error...
    (Wrapped: Unable to load class "com.cache.DBCacheStore" using sun.misc.Launc
    her$AppClassLoader@13f5d07
    <class-scheme>
    <class-name>com.cache.DBCacheStore</class-name>
    </class-scheme>) java.lang.ClassNotFoundException: com.cache.DBCacheStore
    I have the CLASSPATH set to the location of DBCacheStore.class file both in cache-server.cmd and in my application startup JVM params. But still i am not able to resolve this issue. However i am still able to hit the database and get the values for the first call and on sub-sequent call, i am able to retrive the value from cache. I also encounter the below error, after i have retrieved the values from cache...
    2010-11-10 15:08:31.553/29.671 Oracle Coherence GE 3.6.0.0 <Error> (thread=Distr
    ibutedCache, member=1): Terminating PartitionedCache due to unhandled exception:
    java.lang.UnsupportedOperationException
    2010-11-10 15:08:31.553/29.671 Oracle Coherence GE 3.6.0.0 <Error> (thread=Distr
    ibutedCache, member=1):
    java.lang.UnsupportedOperationException
    at java.util.Collections$UnmodifiableMap.put(Collections.java:1285)
    As the exception occurs, the cluster gets restarted and when i re-run the application, it again goes for a DB hit instead of cache hit.
    Note : I have the cache-server.cmd running in one the console window.
    Following is my cache-config.xml file content...
    <?xml version="1.0" encoding="UTF-8" ?>
    <cache-config>
         <caching-scheme-mapping>
              <!--
                   Caches with names that start with 'Virtual' will be created
                   as distributed-db-backed.
              -->
              <cache-mapping>
                   <cache-name>Virtual*</cache-name>
                   <scheme-name>distributed-db-backed</scheme-name>
              </cache-mapping>
         </caching-scheme-mapping>
         <caching-schemes>
              <!--
                   DB Backed Distributed caching scheme.
              -->
              <distributed-scheme>
                   <scheme-name>distributed-db-backed</scheme-name>
                   <service-name>DistributedCache</service-name>
                   <backing-map-scheme>
                        <read-write-backing-map-scheme>
                             <internal-cache-scheme>
                                  <class-scheme>
                                       <class-name>
                                            com.tangosol.util.ObservableHashMap
                                       </class-name>
                                  </class-scheme>
                             </internal-cache-scheme>
                             <cachestore-scheme>
                                  <class-scheme>
                                       <class-name>
                                            com.cache.DBCacheStore
                                       </class-name>
                                       <init-params>
                                            <init-param>
                                                 <param-type>
                                                      java.lang.String
                                                 </param-type>
                                                 <param-value>
                                                      EMP_ADDR_VIEW
                                                 </param-value>
                                            </init-param>
                                       </init-params>
                                  </class-scheme>
                             </cachestore-scheme>
                             <read-only>false</read-only>
                             <!--
                                  To make this a write-through cache just change the value below to 0 (zero)
                             -->
                             <write-delay-seconds>0</write-delay-seconds>
                        </read-write-backing-map-scheme>
                   </backing-map-scheme>
                   <listener />
                   <autostart>true</autostart>
              </distributed-scheme>
         </caching-schemes>
    </cache-config>
    Thanks
    Karthik
    Edited by: user1073902 on Nov 10, 2010 4:25 AM

    Hello Noah,
         I have listed the contents of log file ( for both cache-server.cmd and the client application ).
    cache-server.cmd Log File
    =========================
    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)
    2010-11-11 09:51:49.634/0.236 Oracle Coherence 3.6.0.0 <Info> (thread=main, memb
    er=n/a): Loaded operational configuration from "jar:file:/E:/coherence/lib/coher
    ence.jar!/tangosol-coherence.xml"
    2010-11-11 09:51:49.634/0.236 Oracle Coherence 3.6.0.0 <Info> (thread=main, memb
    er=n/a): Loaded operational overrides from "jar:file:/E:/coherence/lib/coherence
    .jar!/tangosol-coherence-override-dev.xml"
    2010-11-11 09:51:49.634/0.236 Oracle Coherence 3.6.0.0 <D5> (thread=main, member
    =n/a): Optional configuration override "/tangosol-coherence-override.xml" is not
    specified
    2010-11-11 09:51:49.649/0.251 Oracle Coherence 3.6.0.0 <D5> (thread=main, member
    =n/a): Optional configuration override "/custom-mbeans.xml" is not specified
    2010-11-11 09:51:49.649/0.251 Oracle Coherence 3.6.0.0 <D6> (thread=main, member
    =n/a): Loaded edition data from "jar:file:/E:/coherence/lib/coherence.jar!/coher
    ence-grid.xml"
    Oracle Coherence Version 3.6.0.0 Build 17229
    Grid Edition: Development mode
    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    2010-11-11 09:51:49.885/0.487 Oracle Coherence GE 3.6.0.0 <Info> (thread=main, m
    ember=n/a): Loaded cache configuration from "file:/E:/bea/user_projects/workspac
    es/workSpaceStudio/coh/cache-config.xml"
    2010-11-11 09:51:50.231/0.833 Oracle Coherence GE 3.6.0.0 <D4> (thread=main, mem
    ber=n/a): TCMP bound to /10.144.32.78:8088 using SystemSocketProvider
    2010-11-11 09:51:53.786/4.388 Oracle Coherence GE 3.6.0.0 <Info> (thread=Cluster
    , member=n/a): Created a new cluster "mycluster" with Member(Id=1, Timestamp=201
    0-11-11 09:51:50.231, Address=10.144.32.78:8088, MachineId=47694, Location=site:
    XyzT.CORP.Xyz.IN,machine:hdchshocms2026,process:4472, Role=CoherenceServer, Edit
    ion=Grid Edition, Mode=Development, CpuCount=2, SocketCount=2) UID=0x0A90204E000
    0012C392B0817BA4E1F98
    2010-11-11 09:51:53.786/4.388 Oracle Coherence GE 3.6.0.0 <Info> (thread=main, m
    ember=n/a): Started cluster Name=mycluster
    Group{Address=224.0.0.1, Port=5455, TTL=4}
    MasterMemberSet
    ThisMember=Member(Id=1, Timestamp=2010-11-11 09:51:50.231, Address=10.144.32.7
    8:8088, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,p
    rocess:4472, Role=CoherenceServer)
    OldestMember=Member(Id=1, Timestamp=2010-11-11 09:51:50.231, Address=10.144.32
    .78:8088, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026
    ,process:4472, Role=CoherenceServer)
    ActualMemberSet=MemberSet(Size=1, BitSetCount=2
    Member(Id=1, Timestamp=2010-11-11 09:51:50.231, Address=10.144.32.78:8088, M
    achineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,process:44
    72, Role=CoherenceServer)
    RecycleMillis=1200000
    RecycleSet=MemberSet(Size=0, BitSetCount=0
    TcpRing{Connections=[]}
    IpMonitor{AddressListSize=0}
    2010-11-11 09:51:53.833/4.435 Oracle Coherence GE 3.6.0.0 <D5> (thread=Invocatio
    n:Management, member=1): Service Management joined the cluster with senior servi
    ce member 1
    2010-11-11 09:51:54.085/4.687 Oracle Coherence GE 3.6.0.0 <D5> (thread=Distribut
    edCache, member=1): Service DistributedCache joined the cluster with senior serv
    ice member 1
    2010-11-11 09:51:54.101/4.703 Oracle Coherence GE 3.6.0.0 <D6> (thread=Distribut
    edCache, member=1): Service DistributedCache: sending PartitionConfig ConfigSync
    to all
    2010-11-11 09:51:54.116/4.718 Oracle Coherence GE 3.6.0.0 <Info> (thread=main, m
    ember=1):
    Services
    ClusterService{Name=Cluster, State=(SERVICE_STARTED, STATE_JOINED), Id=0, Vers
    ion=3.6, OldestMemberId=1}
    InvocationService{Name=Management, State=(SERVICE_STARTED), Id=1, Version=3.1,
    OldestMemberId=1}
    PartitionedCache{Name=DistributedCache, State=(SERVICE_STARTED), LocalStorage=
    enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartit
    ions=0}
    Started DefaultCacheServer...
    2010-11-11 09:55:41.209/231.811 Oracle Coherence GE 3.6.0.0 <D5> (thread=Cluster
    , member=1): Member(Id=2, Timestamp=2010-11-11 09:55:41.216, Address=10.144.32.7
    8:8090, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,p
    rocess:5304, Role=XyzCacheDatabaseCache) joined Cluster with senior member 1
    2010-11-11 09:55:41.209/231.811 Oracle Coherence GE 3.6.0.0 <D6> (thread=Cluster
    , member=1): TcpRing connecting to Member(Id=2, Timestamp=2010-11-11 09:55:41.21
    6, Address=10.144.32.78:8090, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,ma
    chine:hdchshocms2026,process:5304, Role=XyzCacheDatabaseCache)
    2010-11-11 09:55:41.209/231.811 Oracle Coherence GE 3.6.0.0 <D6> (thread=Cluster
    , member=1): TcpRing connected to Member(Id=2, Timestamp=2010-11-11 09:55:41.216
    , Address=10.144.32.78:8090, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,mac
    hine:hdchshocms2026,process:5304, Role=XyzCacheDatabaseCache)
    2010-11-11 09:55:41.287/231.889 Oracle Coherence GE 3.6.0.0 <D5> (thread=Cluster
    , member=1): Member 2 joined Service Management with senior member 1
    2010-11-11 09:55:41.553/232.155 Oracle Coherence GE 3.6.0.0 <D5> (thread=Cluster
    , member=1): Member 2 joined Service DistributedCache with senior member 1
    2010-11-11 09:55:41.553/232.155 Oracle Coherence GE 3.6.0.0 <Error> (thread=Dist
    ributedCache, member=1): BackingMapManager com.tangosol.net.DefaultConfigurableC
    acheFactory$Manager: failed to instantiate a cache: VirtualCache
    2010-11-11 09:55:41.553/232.155 Oracle Coherence GE 3.6.0.0 <Error> (thread=Dist
    ributedCache, member=1):
    (Wrapped: Unable to load class "com.cache.DBCacheStore" using sun.misc.Launc
    her$AppClassLoader@13f5d07
    <class-scheme>
    <class-name>com.cache.DBCacheStore</class-name>
    <init-params>
    <init-param>
    <param-type>java.lang.String</param-type>
    <param-value>EMP_ADDR_VIEW</param-value>
    </init-param>
    </init-params>
    </class-scheme>) java.lang.ClassNotFoundException: com.cache.DBCacheStore
    at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
    at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2487)
    at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateAny(Defau
    ltConfigurableCacheFactory.java:3256)
    at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStor
    e(DefaultConfigurableCacheFactory.java:3106)
    at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWrite
    BackingMap(DefaultConfigurableCacheFactory.java:1674)
    at com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(
    DefaultConfigurableCacheFactory.java:1429)
    at com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateB
    ackingMap(DefaultConfigurableCacheFactory.java:3904)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.partitionedService.PartitionedCache$Storage.instantiateResourceMap(Partition
    edCache.CDB:21)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.partitionedService.PartitionedCache$Storage.setCacheName(PartitionedCache.CD
    B:25)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.partitionedService.PartitionedCache$ServiceConfig$ConfigListener.entryInsert
    ed(PartitionedCache.CDB:17)
    at com.tangosol.util.MapEvent.dispatch(MapEvent.java:266)
    at com.tangosol.util.MapEvent.dispatch(MapEvent.java:226)
    at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.jav
    a:556)
    at com.tangosol.util.ObservableHashMap.dispatchEvent(ObservableHashMap.j
    ava:229)
    at com.tangosol.util.ObservableHashMap$Entry.onAdd(ObservableHashMap.jav
    a:270)
    at com.tangosol.util.SafeHashMap.put(SafeHashMap.java:244)
    at com.tangosol.coherence.component.util.ServiceConfig$Map.put(ServiceCo
    nfig.CDB:43)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.partitionedService.PartitionedCache$StorageIdRequest.onReceived(PartitionedC
    ache.CDB:45)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.G
    rid.onMessage(Grid.CDB:11)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.G
    rid.onNotify(Grid.CDB:33)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.PartitionedService.onNotify(PartitionedService.CDB:3)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.partitionedService.PartitionedCache.onNotify(PartitionedCache.CDB:3)
    at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.ClassNotFoundException: com.cache.DBCacheStore
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.tangosol.util.ExternalizableHelper.loadClass(ExternalizableHelper
    .java:3011)
    at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2421)
    ... 22 more
    2010-11-11 09:55:41.631/232.233 Oracle Coherence GE 3.6.0.0 <D5> (thread=Distrib
    utedCache, member=1): 3> Transferring primary PartitionSet{0, 1, 2, 3, 4, 5, 6,
    7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
    28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
    48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
    68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
    88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 1
    06, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 1
    22, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 1
    38, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 1
    54, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 1
    70, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 1
    86, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 2
    02, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 2
    18, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 2
    34, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 2
    50, 251, 252, 253, 254, 255, 256} to member 2 requesting 128
    2010-11-11 09:55:41.741/232.343 Oracle Coherence GE 3.6.0.0 <D4> (thread=Distrib
    utedCache, member=1): 1> Transferring 129 out of 129 partitions to a node-safe b
    ackup 1 at member 2 (under 129)
    2010-11-11 09:55:41.757/232.359 Oracle Coherence GE 3.6.0.0 <D5> (thread=Distrib
    utedCache, member=1): Transferring 0KB of backup[1] for PartitionSet{128, 129, 1
    30, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 1
    46, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 1
    62, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 1
    78, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 1
    94, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 2
    10, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 2
    26, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 2
    42, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256} to mem
    ber 2
    2010-11-11 09:55:42.070/232.672 Oracle Coherence GE 3.6.0.0 <D5> (thread=Cluster
    , member=1): TcpRing disconnected from Member(Id=2, Timestamp=2010-11-11 09:55:4
    1.216, Address=10.144.32.78:8090, MachineId=47694, Location=site:XyzT.CORP.Xyz.I
    N,machine:hdchshocms2026,process:5304, Role=XyzCacheDatabaseCache) due to a peer
    departure; removing the member.
    2010-11-11 09:55:42.070/232.672 Oracle Coherence GE 3.6.0.0 <D5> (thread=Cluster
    , member=1): Member 2 left service Management with senior member 1
    2010-11-11 09:55:42.070/232.672 Oracle Coherence GE 3.6.0.0 <D5> (thread=Cluster
    , member=1): Member 2 left service DistributedCache with senior member 1
    2010-11-11 09:55:42.070/232.672 Oracle Coherence GE 3.6.0.0 <D5> (thread=Cluster
    , member=1): Member(Id=2, Timestamp=2010-11-11 09:55:42.07, Address=10.144.32.78
    :8090, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,pr
    ocess:5304, Role=XyzCacheDatabaseCache) left Cluster with senior member 1
    2010-11-11 09:55:42.101/232.703 Oracle Coherence GE 3.6.0.0 <Error> (thread=Dist
    ributedCache, member=1): Terminating PartitionedCache due to unhandled exception
    : java.lang.UnsupportedOperationException
    2010-11-11 09:55:42.101/232.703 Oracle Coherence GE 3.6.0.0 <Error> (thread=Dist
    ributedCache, member=1):
    java.lang.UnsupportedOperationException
    at java.util.Collections$UnmodifiableMap.put(Collections.java:1285)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.partitionedService.PartitionedCache$Storage.putPrimaryResource(PartitionedCa
    che.CDB:44)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.partitionedService.PartitionedCache$Storage.moveResourcesToPrimary(Partition
    edCache.CDB:50)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.partitionedService.PartitionedCache$Storage.movePartition(PartitionedCache.C
    DB:9)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.partitionedService.PartitionedCache.movePartition(PartitionedCache.CDB:14)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.PartitionedService.assignPrimaryPartition(PartitionedService.CDB:38)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.PartitionedService.restoreOrphans(PartitionedService.CDB:42)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.PartitionedService.onOwnershipRequest(PartitionedService.CDB:13)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.PartitionedService$OwnershipRequest.onReceived(PartitionedService.CDB:5)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.G
    rid.onMessage(Grid.CDB:11)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.G
    rid.onNotify(Grid.CDB:33)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.PartitionedService.onNotify(PartitionedService.CDB:3)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g
    rid.partitionedService.PartitionedCache.onNotify(PartitionedCache.CDB:3)
    at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
    at java.lang.Thread.run(Thread.java:619)
    2010-11-11 09:55:42.101/232.703 Oracle Coherence GE 3.6.0.0 <D5> (thread=Distrib
    utedCache, member=1): Service DistributedCache left the cluster
    2010-11-11 09:55:45.012/235.614 Oracle Coherence GE 3.6.0.0 <Info> (thread=main,
    member=1): Restarting Service: DistributedCache
    2010-11-11 09:55:45.012/235.614 Oracle Coherence GE 3.6.0.0 <D5> (thread=Distrib
    utedCache, member=1): Service DistributedCache joined the cluster with senior se
    rvice member 1
    2010-11-11 09:55:45.012/235.614 Oracle Coherence GE 3.6.0.0 <D6> (thread=Distrib
    utedCache, member=1): Service DistributedCache: sending PartitionConfig ConfigSy
    nc to all
    Client Application Log
    ======================
    2010-11-11 09:59:07.380/0.251 Oracle Coherence 3.6.0.0 <Info> (thread=main, member=n/a): Loaded operational configuration from "jar:file:/E:/coherence/lib/coherence.jar!/tangosol-coherence.xml"
    2010-11-11 09:59:07.380/0.251 Oracle Coherence 3.6.0.0 <Info> (thread=main, member=n/a): Loaded operational overrides from "jar:file:/E:/coherence/lib/coherence.jar!/tangosol-coherence-override-dev.xml"
    2010-11-11 09:59:07.380/0.251 Oracle Coherence 3.6.0.0 <D5> (thread=main, member=n/a): Optional configuration override "/tangosol-coherence-override.xml" is not specified
    2010-11-11 09:59:07.380/0.251 Oracle Coherence 3.6.0.0 <D5> (thread=main, member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified
    2010-11-11 09:59:07.395/0.266 Oracle Coherence 3.6.0.0 <D6> (thread=main, member=n/a): Loaded edition data from "jar:file:/E:/coherence/lib/coherence.jar!/coherence-grid.xml"
    Oracle Coherence Version 3.6.0.0 Build 17229
    Grid Edition: Development mode
    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    2010-11-11 09:59:07.896/0.767 Oracle Coherence GE 3.6.0.0 <D4> (thread=main, member=n/a): TCMP bound to /10.144.32.78:8090 using SystemSocketProvider
    2010-11-11 09:59:09.164/2.035 Oracle Coherence GE 3.6.0.0 <Info> (thread=Cluster, member=n/a): This Member(Id=2, Timestamp=2010-11-11 09:59:09.164, Address=10.144.32.78:8090, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,process:2404, Role=XyzCacheDatabaseCache, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=2) joined cluster "mycluster" with senior Member(Id=1, Timestamp=2010-11-11 09:58:30.832, Address=10.144.32.78:8088, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,process:4772, Role=CoherenceServer, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=2)
    2010-11-11 09:59:09.180/2.051 Oracle Coherence GE 3.6.0.0 <D6> (thread=Cluster, member=n/a): TcpRing connecting to Member(Id=1, Timestamp=2010-11-11 09:58:30.832, Address=10.144.32.78:8088, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,process:4772, Role=CoherenceServer)
    2010-11-11 09:59:09.180/2.051 Oracle Coherence GE 3.6.0.0 <D6> (thread=Cluster, member=n/a): TcpRing connected to Member(Id=1, Timestamp=2010-11-11 09:58:30.832, Address=10.144.32.78:8088, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,process:4772, Role=CoherenceServer)
    2010-11-11 09:59:09.180/2.051 Oracle Coherence GE 3.6.0.0 <D5> (thread=Cluster, member=n/a): Member 1 joined Service Cluster with senior member 1
    2010-11-11 09:59:09.180/2.051 Oracle Coherence GE 3.6.0.0 <D5> (thread=Cluster, member=n/a): Member 1 joined Service Management with senior member 1
    2010-11-11 09:59:09.180/2.051 Oracle Coherence GE 3.6.0.0 <D5> (thread=Cluster, member=n/a): Member 1 joined Service DistributedCache with senior member 1
    2010-11-11 09:59:09.180/2.051 Oracle Coherence GE 3.6.0.0 <Info> (thread=main, member=n/a): Started cluster Name=mycluster
    Group{Address=224.0.0.1, Port=5455, TTL=4}
    MasterMemberSet
    ThisMember=Member(Id=2, Timestamp=2010-11-11 09:59:09.164, Address=10.144.32.78:8090, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,process:2404, Role=XyzCacheDatabaseCache)
    OldestMember=Member(Id=1, Timestamp=2010-11-11 09:58:30.832, Address=10.144.32.78:8088, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,process:4772, Role=CoherenceServer)
    ActualMemberSet=MemberSet(Size=2, BitSetCount=2
    Member(Id=1, Timestamp=2010-11-11 09:58:30.832, Address=10.144.32.78:8088, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,process:4772, Role=CoherenceServer)
    Member(Id=2, Timestamp=2010-11-11 09:59:09.164, Address=10.144.32.78:8090, MachineId=47694, Location=site:XyzT.CORP.Xyz.IN,machine:hdchshocms2026,process:2404, Role=XyzCacheDatabaseCache)
    RecycleMillis=1200000
    RecycleSet=MemberSet(Size=0, BitSetCount=0
    TcpRing{Connections=[1]}
    IpMonitor{AddressListSize=0}
    2010-11-11 09:59:09.227/2.098 Oracle Coherence GE 3.6.0.0 <D5> (thread=Invocation:Management, member=2): Service Management joined the cluster with senior service member 1
    2010-11-11 09:59:09.289/2.160 Oracle Coherence GE 3.6.0.0 <Info> (thread=main, member=2): Loaded cache configuration from "file:/E:/bea/user_projects/workspaces/workSpaceStudio/coh/cache-config.xml"
    2010-11-11 09:59:09.461/2.332 Oracle Coherence GE 3.6.0.0 <D5> (thread=DistributedCache, member=2): Service DistributedCache joined the cluster with senior service member 1
    DB Hit
    DBCacheStore(String) called...
    2010-11-11 09:59:09.524/2.395 Oracle Coherence GE 3.6.0.0 <D4> (thread=DistributedCache, member=2): Asking member 1 for 128 primary partitions
    load() called...
    Emp Id:1, Emp Name:Employee, Emp Addr:Address
    Cache Hit
    Emp Id:1, Emp Name:Employee, Emp Addr:Address
    Client Java Program
    ===================
    package com.cache;
    import com.tangosol.net.CacheFactory;
    import com.tangosol.net.NamedCache;
    public class DatabaseCache {
         public DatabaseCache() { }
         private NamedCache cache;
         public void createCache() {
              CacheFactory.ensureCluster();
              cache = CacheFactory.getCache("VirtualCache");
         public void retrieveEntry() {
              System.out.println("DB Hit");
              System.out.println(cache.get("1"));
              System.out.println("Cache Hit");
              System.out.println(cache.get("1"));
         public static void main(String[] args) {
              DatabaseCache databaseCache = new DatabaseCache();
              databaseCache.createCache();
              databaseCache.retrieveEntry();
    DBCacheStore Java Program
    =========================
    Note : I am querying an ORACLE VIEW
    package com.cache;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.util.Collection;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.Map;
    import com.tangosol.net.cache.CacheStore;
    import com.tangosol.util.Base;
    public class DBCacheStore extends Base implements CacheStore {
         private String tableName = null;
         public DBCacheStore() {
              System.out.println("DBCacheStore() called...");
         public DBCacheStore(String tableName) {
              System.out.println("DBCacheStore(String) called...");
              this.tableName = tableName;
         private Connection getConnection() throws Exception {
              Class.forName("oracle.jdbc.driver.OracleDriver");
              String url = "jdbc:oracle:thin:@localhost:1521:xe";
              Connection connection = DriverManager.getConnection(url,"system","manager");
              return connection;
         public void erase(Object arg0) {
              System.out.println("erase() called...");
         public void eraseAll(Collection arg0) {
              System.out.println("eraseAll() called...");
         public void store(Object key, Object value) {
              System.out.println("store() called...");
         public void storeAll(Map arg0) {
              System.out.println("storeAll() called...");          
         public Object load(Object obj) {
              System.out.println("load() called...");
              Employee employee = null;
              Connection con = null;
              PreparedStatement pStmt = null;
              ResultSet rSet = null;
              try {
                   con = getConnection();
                   pStmt = con.prepareStatement("select emp_id, emp_name, address from " + tableName + " where emp_id = ?");
                   pStmt.setInt(1, Integer.parseInt((String)obj));
                   rSet = pStmt.executeQuery();
                   if(rSet.next()) {
                        employee = new Employee();
                        employee.setEmpId(rSet.getInt("emp_id"));
                        employee.setEmpName(rSet.getString("emp_name"));
                        employee.setEmpAddr(rSet.getString("address"));
              } catch(Exception e) {
                   e.printStackTrace();
              } finally {
                   try {
                        if(rSet != null)
                             rSet.close();
                        if(pStmt != null)
                             pStmt.close();
                        if(con != null)
                             con.close();
                   } catch(Exception e) {
                        e.printStackTrace();
              return employee;
         public Map loadAll(Collection arg0) {
              System.out.println("loadAll() called...");
              Connection con = null;
              PreparedStatement pStmt = null;
              ResultSet rSet = null;          
              Employee employee = null;
              Map empMap = new HashMap();
              try {
                   con = getConnection();
                   pStmt = con.prepareStatement("select emp_id, emp_name, address from " + tableName);
                   rSet = pStmt.executeQuery();
                   while(rSet.next()) {
                        employee = new Employee();
                        employee.setEmpId(rSet.getInt("emp_id"));
                        employee.setEmpName(rSet.getString("emp_name"));
                        employee.setEmpAddr(rSet.getString("address"));
                        empMap.put(employee.getEmpId(), employee);
              } catch(Exception e) {
                   e.printStackTrace();
              } finally {
                   try {
                        if(rSet != null)
                             rSet.close();
                        if(pStmt != null)
                             pStmt.close();
                        if(con != null)
                             con.close();
                   } catch(Exception e) {
                        e.printStackTrace();
              return empMap;
         public Iterator keys() {
              Connection con = null;
              PreparedStatement pStmt = null;
              ResultSet rSet = null;          
              List returnList = null;
              try {
                   con = getConnection();
                   pStmt = con.prepareStatement("select emp_id from emp_addr_view");
                   rSet = pStmt.executeQuery();
                   returnList = new LinkedList();
                   while(rSet.next()) {
                        returnList.add(rSet.getString("empId"));
              } catch(Exception e) {
                   e.printStackTrace();
              } finally {
                   try {
                        if(rSet != null)
                             rSet.close();
                        if(pStmt != null)
                             pStmt.close();
                        if(con != null)
                             con.close();
                   } catch(Exception e) {
                        e.printStackTrace();
              return returnList.iterator();
    cache-server.cmd added lines
    ============================
    set CLASSPATH=%CLASSPATH%;E:\bea\user_projects\workspaces\workSpaceStudio\coh\bin;E:\bea\wlserver_10.0\server\lib\ojdbc14.jar;
    Note : E:\bea\user_projects\workspaces\workSpaceStudio\coh\bin in the above line contains compiled class files starting from "com" folder.
    "%java_exec%" -server -showversion "%java_opts%" -cp E:\bea\user_projects\workspaces\workSpaceStudio\coh\bin -Dtangosol.coherence.log.level=9 -Dtangosol.coherence.cluster=mycluster -Dtangosol.coherence.clusteraddress=224.0.0.1 -Dtangosol.coherence.clusterport=5455 -Dtangosol.coherence.cacheconfig=E:\bea\user_projects\workspaces\workSpaceStudio\coh\cache-config.xml -cp "%coherence_home%\lib\coherence.jar" com.tangosol.net.DefaultCacheServer %1
    JVM arguments for running Client Program : DatabaseCache.java
    =======================================
    -Dtangosol.coherence.cacheconfig=E:\bea\user_projects\workspaces\workSpaceStudio\coh\cache-config.xml
    -Dtangosol.coherence.cluster=mycluster
    -Dtangosol.coherence.clusteraddress=224.0.0.1
    -Dtangosol.coherence.clusterport=5455
    ==================================================================================================
    Please do let me know if you require further information.
    Thanks
    Karthik

  • How to get the number of rows in a ResultSet

    Hello,
    I'm an intern and I'm trying to get the number of rows from result set in oracle using rs.last() and rs.beforeFirst() methods
    but I got an error. Could Below is my sample code:
    import java.sql.*;
    public class SarueckConnect {
    public static void main(String[] args) {
    Connection con = null;
    Statement stmt = null;
    ResultSet re = null;
    String[] ParamArray;
    ParamArray = new String[24];
    //Properties logon;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver"); //Loading the Oracle Driver.
    con = DriverManager.getConnection
    ("jdbc:oracle:thin:@258.8.159.215:1521:test_DB","data","data"); //making the connection DB.
    stmt = con.createStatement ();// Sending a query string to the database
    //stmt.executeUpdate("UPDATE test_table set steuk = 6 WHERE steuk = 5");
    ResultSet rs = stmt.executeQuery("SELECT mandt,kokrs,werks,arbpl,aufnr,vornr,ile01,"+
    "lsa01,ism01,ile02,lsa02,ism02,ile03,lsa03,ism03,ile04,lsa04,ism04,steuk,matnr,budat,"+
    "kostl,pernr,rueckid FROM test_table where steuk =6");
    //Print the result out.
    rs.last(); //This is the line which gives an error.
    int rows = rs.getRow();
    rs.beforeFirst();// I presume this is wrong to.
    ParamArray = new String[24*rows];
    int counter=0;
    while (rs.next()) {
    for (int i = 1; i <= 24; i++){
    ParamArray[i-1+(counter*24)] = rs.getString(i);
    System.out.print(rs.getString(i) + '\t');
    System.out.println();
    counter++;
    } catch(Exception e) {
    e.printStackTrace();
    } finally {
    try
    if(stmt != null) stmt.close();
    if(con != null) con.close();
    } catch (Exception exception) {
    exception.printStackTrace();
    TryBapi sap = new TryBapi(ParamArray);
    }When I run the code I do have the following ERROR Message:
    java.sql.SQLException: Invalid operation for forward only resultset : last
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.driver.BaseResultSet.last(BaseResultSet.java:91)
    at SarueckConnect.main(SarueckConnect.java:28)Please could any body Help me out here to figure out how to correct this?
    Any Help would be highly apprecited.

    make your result set scrollable...Not such a good idea. With Oracle, the JDBC driver will read and cache all the ResultSet in memory (with other DBMSs/drivers the behavior will probably be different, but you will still have some unnecessary overhead).
    You can do the caching yourself if you think it's worth it. If the piece of code you posted is why you need this for, then use a List or Vector and you won't need to know the size upfront.
    Alin,
    The jTDS Project.

  • Resultset - retrieves all rows or only one at a time

    Hey guys,
    I am using oracle DB. Lets say the query i run has about 1000 records
    when i call:
    prepareStmt(cstmt);
    Rsultset rs = cstmt.executeQuery();
    Do I get all the records, or do i get them one by one
    when i call
    rs.next
    is this DB specific??
    This is simple q, but i been working with oracle and java for a while, and for some reason this never came up.
    thank you.

    The driver implementation is free to retrieve as many or as few rows at a time from the database as it wants. You can suggest to the driver how many rows at a time it should retrieve with setFetchSize(); the driver is free to ignore your suggestion (but many drivers honor it). The fetch size default varies wildly from driver to driver, from 1 row at a time to all rows at a once. For the Oracle thin driver, the default is 10, which is usually too small to give the best performance (I use between 100 and 1,000, usually 250).
    Note that when you're working with a very large ResultSet, a driver that does "all rows at once" can cause you to run out of memory. Also, some drivers will cache every single row when using a scrollable ResultSet (and again run you out of memory) but not do so with a forward-only ResultSet (Oracle has this issue).

  • Help Needed in persisting data in cache from CEP on to a database

    Hi,
    We are trying to create a Oracle Complex Event Processing (CEP) application in which persist the data stored in the cache (Oracle Coherence) to a back end database
    Let me provide you the steps that I have followed:
    1)     Created a CEP project with cache implementation to store the events.
    2)     Have the following configuration in the context file:
    <wlevs:cache id="Task_IN_Cache" value-type="Task" key-properties="TASKID" caching-system="CachingSystem1">
    <wlevs:cache-store ref="cacheFacade"></wlevs:cache-store>
    </wlevs:cache>
    <wlevs:caching-system id="CachingSystem1" provider="coherence">
    <bean id="cacheFacade" class="com.oracle.coherence.handson.DBCacheStore">
    </bean>
    3)     Have the following in the coherence cache config xml:
    <cache-mapping>
    <cache-name>Task_IN_Cache</cache-name>
    <scheme-name>local-db-backed</scheme-name>
    </cache-mapping>
    <local-scheme>
    <scheme-name>local-db-backed</scheme-name>
    <service-name>LocalCache</service-name>
    <backing-map-scheme>
    <read-write-backing-map-scheme>
    <internal-cache-scheme>
    <local-scheme/>
    </internal-cache-scheme>
    <cachestore-scheme>
    <class-scheme>
    <class-name>com.oracle.coherence.handson.DBCacheStore</class-name>
    </class-scheme>
    </cachestore-scheme>
    </read-write-backing-map-scheme>
    </backing-map-scheme>
    </local-scheme>
    4)     Have configured tangosol-coherence-override.xml to make use of coherence in my local machine.
    5)     Have written a class that implements com.tangosol.net.cache.CacheStore
    public class DBCacheStore implements CacheStore{
    But when I try to deploy the project on to the CEP server getting the below error:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Task_IN_AD': Cannot resolve reference to bean 'wlevs_stage_proxy_forTask_IN_Cache' while setting bean property 'listeners' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wlevs_stage_proxy_forTask_IN_Cache': Cannot resolve reference to bean '&Task_IN_Cache' while setting bean property 'cacheFactoryBean'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Task_IN_Cache': Invocation of init method failed; nested exception is java.lang.RuntimeException: Error while deploying application 'AIT_Caching'. Cache store specified for cache 'Task_IN_Cache' does not implement the required 'com.tangosol.net.cache.CacheStore' interface.
    Can you please let me know if I am missing any configuration. Appreciate your help.

    Hi JK,
    Yes my class com.oracle.coherence.handson.DBCacheStore implements the com.tangosol.net.cache.CacheStore interface. I am providing you with the DBCacheStore class.
    package com.oracle.coherence.handson;
    import com.tangosol.net.CacheFactory;
    import com.tangosol.net.NamedCache;
    import com.tangosol.net.cache.CacheStore;
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.Map;
    import oracle.jdbc.pool.OracleDataSource;
    public class DBCacheStore implements CacheStore {
    protected Connection m_con;
    protected String m_sTableName;
    private static final String DB_DRIVER = "oracle.jdbc.OracleDriver";
    private static final String DB_URL = "jdbc:oracle:thin:@XXXX:1521:XXXX";
    private static final String DB_USERNAME = "XXXX";
    private static final String DB_PASSWORD = "XXXX";
    public DBCacheStore()
    m_sTableName = "TASK";
    System.out.println("Inside constructor");
    init();
    //store("10002", "10002");
    public void init()
    try
         OracleDataSource ods = new OracleDataSource();
    /* Class.forName(DB_DRIVER);
    m_con = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
    m_con.setAutoCommit(true);*/
         ods.setURL(DB_URL);
         ods.setUser(DB_USERNAME);
         ods.setPassword(DB_PASSWORD);
         m_con = ods.getConnection();
    System.out.println("Connection Successful");
    catch (Exception e)
         e.printStackTrace();
    //throw ensureRuntimeException(e, "Connection failed");
    public String getTableName() {
    return m_sTableName;
    public Connection getConnection()
    return m_con;
    public Object load(Object oKey)
    Object oValue = null;
    Connection con = getConnection();
    String sSQL = "SELECT TASKID, REQNUMBER FROM " + getTableName()
    + " WHERE TASKID = ?";
    try
    PreparedStatement stmt = con.prepareStatement(sSQL);
    stmt.setString(1, String.valueOf(oKey));
    ResultSet rslt = stmt.executeQuery();
    if (rslt.next())
    oValue = rslt.getString(2);
    if (rslt.next())
    throw new SQLException("Not a unique key: " + oKey);
    stmt.close();
    catch (SQLException e)
    //throw ensureRuntimeException(e, "Load failed: key=" + oKey);
    return oValue;
    public void store(Object oKey, Object oValue)
         System.out.println("Inside Store method");
         NamedCache cache = CacheFactory.getCache("Task_IN_Cache");
         System.out.println("Cache Service:" + " "+ cache.getCacheService());
         System.out.println("Cache Size:" + " "+ cache.size());
         System.out.println("Is Active:" + " "+ cache.isActive());
         System.out.println("Is Empty:" + " "+ cache.isEmpty());
         //cache.put("10003", "10003");
         //System.out.println("Values:" + " "+ cache.put("10003", "10003"));
    Connection con = getConnection();
    String sTable = getTableName();
    String sSQL;
    if (load(oKey) != null)
    sSQL = "UPDATE " + sTable + " SET REQNUMBER = ? where TASKID = ?";
    else
    sSQL = "INSERT INTO " + sTable + " (TASKID, REQNUMBER) VALUES (?,?)";
    try
    PreparedStatement stmt = con.prepareStatement(sSQL);
    int i = 0;
    stmt.setString(++i, String.valueOf(oValue));
    stmt.setString(++i, String.valueOf(oKey));
    stmt.executeUpdate();
    stmt.close();
    catch (SQLException e)
    //throw ensureRuntimeException(e, "Store failed: key=" + oKey);
    public void erase(Object oKey)
    Connection con = getConnection();
    String sSQL = "DELETE FROM " + getTableName() + " WHERE id=?";
    try
    PreparedStatement stmt = con.prepareStatement(sSQL);
    stmt.setString(1, String.valueOf(oKey));
    stmt.executeUpdate();
    stmt.close();
    catch (SQLException e)
    // throw ensureRuntimeException(e, "Erase failed: key=" + oKey);
    public void eraseAll(Collection colKeys)
    throw new UnsupportedOperationException();
    public Map loadAll(Collection colKeys) {
    throw new UnsupportedOperationException();
    public void storeAll(Map mapEntries)
         System.out.println("Inside Store method");
    throw new UnsupportedOperationException();
    public Iterator keys()
    Connection con = getConnection();
    String sSQL = "SELECT id FROM " + getTableName();
    List list = new LinkedList();
    try
    PreparedStatement stmt = con.prepareStatement(sSQL);
    ResultSet rslt = stmt.executeQuery();
    while (rslt.next())
    Object oKey = rslt.getString(1);
    list.add(oKey);
    stmt.close();
    catch (SQLException e)
    //throw ensureRuntimeException(e, "Iterator failed");
    return list.iterator();
    }

  • How do I handle large resultsets in CRXI without a performance issue?

    Hello -
    Problem Definition
    I have a performance problem displaying large/huge resultset of data on a crystal report.  The report takes about 4 minutes or more depending on the resultset size.
    How do you handle large resultsets in Crystal Reports without a performance issue?
    Environment
    Crystal Reports XI
    Apache WebSvr 2.X, Jboss 4.2.3, Struts
    Java Reporting Component (JRC),Crystal Report Viewer (CRV)
    Firefox
    DETAILS
    I use the CRXI thick client to build my report (.rpt) and then use it in my webapplication (webapp) under Jboss.
    User specifies the filter criteria to generate a report (date range etc) and submits the request to the webapp.  Webapp  queries the database, gets a "resultset".
    I initialize the JRC and CRV according to all the specifications and finally call the "processHttpRequest" method of Crystal Report Viewer to display the report on browser.
    So.....
    - Request received to generate a report with a filter criteria
    - Query DB to get resultset
    - Initialize JRC and CRV
    - finally display the report by calling
        reportViewer.processHttpRequest(request, response, request.getSession().getServletContext(), null);
    The performance problem is within the last step.  I put logs everywhere and noticed that database query doesnt take too long to return resultset.  Everything processes pretty quickly till I call the processHttpRequest of CRV.  This method just hangs for a long time before displaying the report on browser.
    CRV runs pretty fast when the resultset is smaller, but for large resultset it takes a long long time.
    I do have subreports and use Crystal report formulas on the reports.  Some of them are used for grouping also.  But I dont think Subreports is the real culprit here.  Because I have some other reports that dont have any subreports, and they too get really slow displaying large resultsets.
    Solutions?
    So obviously I need a good solution to this generic problem of "How do you handle large resultsets in Crystal Reports?"
    I have thought of some half baked ideas.
    A) Use external pagination and fetch data only for the current page being displayed.  But for this, CRXI must allow me to create my own buttons (previous, next, last), so I can control the click event and fetch data accordingly.  I tried capturing events by registering event handler "addToolbarCommandEventListener" of CRV.  But my listener gets invoked "after" processHttpRequest method completes, which doesnt help.
    Some how I need to be able to control the UI by adding my own previous page, next page, last page buttons and controlling it's click events. 
    B) Automagically have CRXI use a javascript functionality, to allow browser side page navigation.  So maybe the first time it'll take 5 mins to display the report, but once it's displayed, user can go to any page without sending the request back to server.
    C) Try using Crystal Reports 2008.  I'm open to using this version, but I couldnt figureout if it has any features that can help me do external pagination or anything that can handle large resultsets.
    D) Will using the Crystal Reports Servers like cache server/application server etc help in any way?  I read a little on the Crystal Page Viewer, Interactive Viewer, Part Viewer etc....but I'm not sure if any of these things are going to solve the issue.
    I'd appreciate it if someone can point me in the right direction.

    Essentialy the answer is use smaller resultsets or pull from the database directly instead of using resultsets.

  • Oracle.apps.fnd.cache.CacheException in login page

    Hi,
    i wrote one method in am and return that values to co and the following is the code in AM
    public String Status(String reqid){
        String Status2=null;
    String Status;
        while(Staus.equals("I")||Staus.equals("R")||Staus.equals("P"))
          try{
            try
               Thread.sleep(1000);
             } catch (InterruptedException e)
                System.out.println("eroor in am thread block");
            String Query ="select phase_code,status_code from fnd_concurrent_requests where request_id=?";
            PreparedStatement stmt = getOADBTransaction().createPreparedStatement(Query,1);
            stmt.setString(1,requestid);
            ResultSet resultset= stmt.executeQuery();
            if (resultset != null)
              while (resultset.next())
              if (resultset.getString(1) != null)
               Staus = resultset.getString(1); // here to fetch the column from the query
                Status2=resultset.getString(2);
          catch(SQLException exception)
          //Incase of any error while running the query throw an exception.
          throw new OAException("Error in  Query"+ exception, OAException.ERROR);
    return Status2;
    here iam checking phase code of the programe ,f it is C iam returning the status to variable in CO.it is taking one hour time to complete to get the status code :C
    in the application,program  is   runnig but after getting "C" also the progres is still running. i closed the session and opened again and it is giving following error:
    oracle.apps.fnd.cache.CacheException
    Please help me to solve this , i got the request id but while getting status only iam facing issue..

    Hi,
    1. Are you submitting this concurrent program from your code, if yes then you should issue commit immediately after submitting the request.
    OR
    2. Try using below PL/SQL block code in your AM (please convert to java call ).
    DECLARE
    l_request_id                               NUMBER;
    o_call_status                             BOOLEAN;
    o_request_phase                              VARCHAR2(200);
    o_request_status                             VARCHAR2(200);
    o_dev_request_phase                          VARCHAR2(200);
    o_dev_request_status                         VARCHAR2(200);
    o_request_status_mesg                        VARCHAR2(2000);
    BEGIN
               o_call_status := fnd_concurrent.wait_for_request(l_request_id,
                                                                 20,
                                                                 0,
                                                                 o_request_phase,
                                                                 o_request_status,
                                                                 o_dev_request_phase,
                                                                 o_dev_request_status,
                                                                 o_request_status_mesg);
    END;
    Regards,
    Sandeep M.

Maybe you are looking for