Using cache for read only data

In my application I have to display some read only data (in number of drop down present on several portlets)
this data might be driven from the database or from some XML/property file.Not decided yet.
for example : Country /state/City/Zip code etc..
Kindly let me know how can I implement the same in Weblogic Portal 10.0.
Do I have to use some third party caching mechanism like Hibernate cache for this
or
Weblogic portal do support caching ??
Please suggest the all possible soultions to implement this.

Cache cache = CacheFactory.getCache("yourCache"); //any name can be passed, and you can create as many as you want , perhaps by functionality, perhaps by size etc. If you want to configure statically you must use this name in the xml file. If you define it in the xml file , you can administer the cache from Portal Admin
cache.put("key","value");
cache.get("key");
There are other advanced things you can do like Time To live / flushing / auto reload the cache which is all described in the javadoc
regards
deepak

Similar Messages

  • JDBC or Entity Beans for Read-Only Data?

    Entity beans are way to slow on pulling the amount of data I need. What are the cons of just using JDBC? Is this bad programming?
    One query pulls about 700 rows from 6 different tables taking up to 20 seconds. The same call using JDBC takes 2 seconds. What is the proper thing to do?

    One query pulls about 700 rows from 6 different
    tables taking up to 20 seconds. The same call using
    JDBC takes 2 seconds. What is the proper thing to do?JDBC. Entity beans are not really suited for data across multiple tables. This can be best done with plain SQL +JDBC.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • We collected data using NI in the Labview environmen​t and created tdms document. Is there a reader for reading the data in Matlab environmen​t?

    We collected data using NI in the Labview environment and created tdms document. Is there a reader for reading the data in Matlab environment?

    A search will often turn up results.
    Reading TDM/TDMS Files with The MathWorks, Inc. MATLAB® Software

  • Best practice for read-only functionality

    Hi,
    I'm part of the development team of a system with about 100 screens. The customer would like us to add some read-only functionality to the system, so that certain users are able to access the screens but not change any of the data on them. We already have policies in place on the database level that keeps read-only users from saving data, but it's not very user friendly to allow users to change data on a screen, only to tell them that they're not allowed to save those changes once they try to do so. It would clearly be better if all components are rendered as read-only components for read-only users, making them unable to make any data changes in the first place.
    User privileges in the system are controlled by roles defined and set in the system (not ADF roles or Weblogic roles). At any given time and place, it's possible to check whether the current user has a certain role. We already use this in a number of places to make it possible to control which user has access to which screens. In a few places we even control which functionality should be enabled for the current user within a screen, but mostly the access control is currently on the screen level. With read-only users getting access to all screens, it seems we will need lot of extra in-screen access control to keep these users from changing anything.
    But what's the best practice here? One way to go would be to add some logic to every single active component on every single screen, to determine whether it should be rendered as active or disabled/read-only. But that would require a lot of extra coding.
    So my question is: Is there a smarter way to do this? Maybe something done through skinning? Or something else?
    (I'm not sure how relevant this is for this sort of question, but we're currently using JDev 11.1.1.4.0, and expect to upgrade to 11.1.1.6.0 within the next 6 months)
    Best regards,
    Andreas

    Hi Guna, Puthanampatti and Don,
    Thanks a lot for your replies. I'm currently looking into implementing something along the lines of what Guna has suggested:
    Our application consists of a number of individual work spaces that are deployed as adflibs which have all been added to a "master application work space", and the master application is deployed as an .ear file. Most of the individual work spaces are for all the different functional areas of the application, with their own task flows, page fragments etc. The rest are work spaces with common functionality, like datamodel (entity definitions), utility methods, page templates, and framework extensions. In the latter, we have defined custom classes for all the base classes (somewhat similar to what Don describes, I believe).
    In our custom class for ViewRowImpl, I have added an isAttributeUpdateable method, and in our custom class for ApplicationModuleImpl I have added an isReadOnlyUser method. The isAttributeUpdateable method uses the isReadOnlyUser method to determine if the current user is a read-only user or not; if the user is a read-only user the isAttributeUpdateable method will return false, otherwise true. The isReadOnlyUser method in our base class is just a dummy method that always returns true. But in the ApplicationModuleImpl classes of our individual work spaces, i've written an override for isReadOnlyUser, giving the answer that is relevant for the work space in question (for instance, whether or not the current user has the role "User Administrator").
    That pretty much takes care of all input fields in tables and forms, which is a big step in the right direction. This still leaves some work to be done for components that are not directly linked to view object attributes (like buttons), but I guess that can't be helped. Also, there are a few of the work spaces that contain a number of pages that are related to different user privileges (as in: page 1 requires user privilege A, and page 2 requires user privilege B); in these cases I will have to do something different than just writing an override in the "local" ApplicationModuleImpl class.
    @Don: What you describe seems to be pretty close in functionality to what we already have, though your implementation is different from ours. You have used your custom base ApplicationModuleImpl class to keep read-only users from committing changes. We use Virtual Private Database and database policies to the same end: If a user without the required full-access role tries to commit data it will cause a database error, which we then handle in the application (so the user gets a message like "You don't have the required privileges to changes this data", rather than an ORA message). Unfortunately, our customers are not content with this. They want a solution where all input fields and most of the buttons etc. are disabled for read-only users, and that's why I'm looking into the best/smartest way to do this.
    @Puthanampatti: We already use something similar to what you're suggesting. The challenge I'm currently facing is how best to disable/enable components based on the current user's roles, not how to determine and store those roles.
    Best regards,
    Andreas

  • Access denied to a READ-ONLY data source

    Post Author: covey9257
    CA Forum: Data Connectivity and SQL
    I'm using Crystal 10 sevice pack 6.  My report is using an ODBC connection to a PSql 9.5 stored procedure.  The stored procedure creates a temp table and inserts records from 3 different ticket tables.  It has one parameter in it that selects which location to load the table with.  My report works fine as long as I don't try to put any of the fields from the temp table on the report.  If I do, then I get the following error.
    Failed to open a rowset. Details: 42000:[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface][Data Record Manager][SPEng][Pervasive][ODBC Engine Interface]Access denied to a READ-ONLY data source.
    I found that this was an issue in Crystal 9.0, but nothing with cr 10.
    Does anyone know of a work around or fix for this scenario??
    Thanks - Cathy

    Thanks for the quick reply Don.
    If you have the option that Pervasive uses to not use the exclusive lock on the DB try adding it to the SQLExpression function in CR.
    I am not sure how to accomplish this.  I've done some quick searching but cannot come up with SQL that indicates locking unless I am using some kind of language like VB or C#.
    Here is my Command Object statement
    INSERT INTO RASAPSign
    (sVendNo, sChqNo, dtDateSigned)
    VALUES
    ('{?VendNum}', '{?ChqNum}', CURDATE());
    SELECT sVendNo, sChqNo, dtDateSigned
    FROM RASAPSign
    WHERE sVendNo = '{?VendNum}' and sChqNo = '{?ChqNum}'
    Can you give me an idea of what to change?  Or at least what terminology to search for?
    I tried this option with BEGIN and END
    BEGIN
    INSERT INTO RASAPSign
    (sVendNo, sChqNo, dtDateSigned)
    VALUES
    ('{?VendNum}', '{?ChqNum}', CURDATE());
    END
    SELECT sVendNo, sChqNo, dtDateSigned
    FROM RASAPSign
    WHERE sVendNo = '{?VendNum}' and sChqNo = '{?ChqNum}'
    But I get a syntax error.
    Thanks, rasinc
    Edited by: rasinc on Apr 14, 2011 3:28 PM
    To show code with Begin and End

  • Load balancing not happending but fail over is for Read only Entity beans

              The following are the configuration.
              Two NT servers with WL5.1 sp9 having only EJBs(Read only entity beans)
              One Client with WL5.1 sp9 having servlet/java application as
              EJB client.
              I am trying to make a call like findbyprimarykey in one of the
              entity bean. I could see the request is being directed only to the one of the
              server always. When I bring that server, fail over is happening to the other server.
              Here are the settings I have in the ejb-jar.xml :
                        <entity>
                             <ejb-name>device.StartHome</ejb-name>
                             <home>com.wl.api.device.StartHome</home>
                             <remote>com.wl.api.device.StartRemote</remote>
                             <ejb-class>com.wl.server.device.StartImpl</ejb-class>
                             <persistence-type>Bean</persistence-type>
                             <prim-key-class>java.lang.Long</prim-key-class>
                             <reentrant>False</reentrant>
                             <resource-ref>
                                  <res-ref-name>jdbc/wlPool</res-ref-name>
                                  <res-type>javax.sql.DataSource</res-type>
                                  <res-auth>Container</res-auth>
                             </resource-ref>
                        </entity>
              Here are the settings I have in the weblogic-ejb-jar.xml.
              <weblogic-enterprise-bean>
                        <ejb-name>device.StartHome</ejb-name>
                        <caching-descriptor>
                             <max-beans-in-cache>50</max-beans-in-cache>
                             <cache-strategy>Read-Only</cache-strategy>
                             <read-timeout-seconds>900</read-timeout-seconds>
                        </caching-descriptor>
                        <reference-descriptor>
                             <resource-description>
                                  <res-ref-name>jdbc/wlPool</res-ref-name>
                                  <jndi-name>weblogic.jdbc.pool.wlPool</jndi-name>
                             </resource-description>
                        </reference-descriptor>
                        <enable-call-by-reference>False</enable-call-by-reference>
                        <jndi-name>device.StartHome</jndi-name>
                   </weblogic-enterprise-bean>
              Am I doin any mistake in this?
              Any one's help is appreciated.
              Thanks
              Suresh
              

    we are using 5.1
              "Gene Chuang" <[email protected]> wrote in message
              news:[email protected]...
              > Colocation optimization occurs if your client resides in the same
              container (and also in the same
              > EAR for 6.0) as your ejbs.
              >
              > Gene
              >
              > "Suresh" <[email protected]> wrote in message
              news:[email protected]...
              > > Ok....the ejb-call-by-reference set to true is making the call to one
              server
              > > only. i am not sure why it is. I removed the property name and it
              works.
              > > Also I have one question, in our prduct environment, when i cache the
              ejb
              > > home it is not doing the load balancing. can any one help me for that.
              > > thanks
              > >
              > > Mike,
              > > From the sample pgm I sent, even from single client calls get load
              > > balanced.
              > >
              > > Suresh
              > >
              > >
              > > "Gene Chuang" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > In WL, LoadBalancing will ONLY WORK if you reuse your EJBHome! Take
              your
              > > StartEndPointHome lookup
              > > > out of your for loop and see if this fixes your problem.
              > > >
              > > > I've seen this discussion in ejb-interest, and some other vendor
              (Borland,
              > > I believe it is), brings
              > > > up an interesting point: Clustering and LoadBalance is not in the
              J2EE
              > > specs, hence implementation
              > > > is totally up to the vendor. Weblogic loadbalances from the remote
              > > interfaces (EJBObject, EJBHome,
              > > > etc..), while Borland loadbalances from JNDI Context lookup.
              > > >
              > > > Let me suggest a third implmentation: loadbalance from BOTH Context
              > > lookup as well as stub method
              > > > invocation! Or create a smart replica-aware list manager which
              persists
              > > on the client thread
              > > > (ThreadLocal) and is aware of lookup/evocation history. Hence if I do
              the
              > > following in a client
              > > > hitting a 3 node cluster, I'll still get perfect round-robining
              regardless
              > > of what I do on the
              > > > client side:
              > > >
              > > > InitialContext ctxt = new InitialContext();
              > > > EJBHome myHome = ctxt.lookup(MY_BEAN);
              > > > myHome.findByPrimaryKey(pk); <== hits Node #1
              > > > myHome = ctxt.lookup(MY_BEAN);
              > > > myHome.findByPrimaryKey(pk); <== hits Node #2
              > > > myHome.findByPrimaryKey(pk); <== hits Node #3
              > > > myHome = ctxt.lookup(MY_BEAN);
              > > > myHome.findByPrimaryKey(pk); <== hits Node #1
              > > > ...
              > > >
              > > >
              > > > Gene
              > > >
              > > > "Suresh" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > > Mike ,
              > > > >
              > > > > Do you have any reasons for the total number of machines to be 10.
              > > > >
              > > > > I tried with 7 machines.
              > > > >
              > > > >
              > > > > Here is my sample client java application running individual in the
              > > seven
              > > > > machines.
              > > > >
              > > > > StartEndPointHome =
              > > > > (StartEndPointHome)ctx.lookup("dev.StartEndPointHome");
              > > > > for(;;)
              > > > > {
              > > > > // logMsg(" --in loop "+currentTime);
              > > > > if (currentTime > nextRefereshTime)
              > > > > {
              > > > > logMsg("****- going to call");
              > > > > currentTime=getSystemTime();
              > > > > nextRefereshTime=currentTime+timeInterval;
              > > > > StartEndPointHome =
              > > > > (StartEndPointHome)ctx.lookup("dev.StartEndPointHome");
              > > > > long rndno=(long)(Math.random()*10)+range;
              > > > > logMsg(" going to call remotestub"+rndno);
              > > > > retVal =
              > > > >
              > >
              ((StartEndPointHome)getStartHome()).findByNumber("pe"+rndno+"_mportal_dsk36.
              > > > > mportal.com");
              > > > >
              > > > > logMsg("**++- called stub");
              > > > > }
              > > > >
              > > > >
              > > > >
              > > > > The range value is different for each of the machines in the
              cluster.
              > > > >
              > > > > If the first request starts at srv1, all request starts hitting the
              same
              > > > > server.
              > > > > If the first request starts at srv2, all request starts hitting the
              same
              > > > > server.
              > > > >
              > > > > I have the following for the url , user and pwd values for the
              context
              > > .
              > > > >
              > > > > public static String url="t3://10.11.12.14,10.11.12.117:8000";
              > > > > public static String user="guest";
              > > > > public static String password="guest";
              > > > >
              > > > >
              > > > >
              > > > > It would be great if you could help me.
              > > > >
              > > > > Thanks
              > > > > suresh
              > > > >
              > > > >
              > > > > "Mike Reiche" <[email protected]> wrote in message
              > > > > news:[email protected]...
              > > > > >
              > > > > > If you have only one client don't be surprised if you only hit one
              > > server.
              > > > > Try
              > > > > > running ten different clients and see if the hit the same server.
              > > > > >
              > > > > > Mike
              > > > > >
              > > > > >
              > > > > > "suresh" <[email protected]> wrote:
              > > > > > >
              > > > > > >The following are the configuration.
              > > > > > >
              > > > > > > Two NT servers with WL5.1 sp9 having only EJBs(Read only entity
              > > beans)
              > > > > > >
              > > > > > > One Client with WL5.1 sp9 having servlet/java application as
              > > > > > > EJB client.
              > > > > > >
              > > > > > >
              > > > > > >I am trying to make a call like findbyprimarykey in one of the
              > > > > > >entity bean. I could see the request is being directed only to
              the
              > > one
              > > > > > >of the
              > > > > > >server always. When I bring that server, fail over is happening
              to
              > > the
              > > > > > >other server.
              > > > > > >
              > > > > > >
              > > > > > >Here are the settings I have in the ejb-jar.xml :
              > > > > > > <entity>
              > > > > > > <ejb-name>device.StartHome</ejb-name>
              > > > > > > <home>com.wl.api.device.StartHome</home>
              > > > > > > <remote>com.wl.api.device.StartRemote</remote>
              > > > > > > <ejb-class>com.wl.server.device.StartImpl</ejb-class>
              > > > > > > <persistence-type>Bean</persistence-type>
              > > > > > > <prim-key-class>java.lang.Long</prim-key-class>
              > > > > > > <reentrant>False</reentrant>
              > > > > > > <resource-ref>
              > > > > > > <res-ref-name>jdbc/wlPool</res-ref-name>
              > > > > > > <res-type>javax.sql.DataSource</res-type>
              > > > > > > <res-auth>Container</res-auth>
              > > > > > > </resource-ref>
              > > > > > > </entity>
              > > > > > >
              > > > > > >
              > > > > > >Here are the settings I have in the weblogic-ejb-jar.xml.
              > > > > > >
              > > > > > ><weblogic-enterprise-bean>
              > > > > > > <ejb-name>device.StartHome</ejb-name>
              > > > > > >
              > > > > > > <caching-descriptor>
              > > > > > > <max-beans-in-cache>50</max-beans-in-cache>
              > > > > > > <cache-strategy>Read-Only</cache-strategy>
              > > > > > > <read-timeout-seconds>900</read-timeout-seconds>
              > > > > > > </caching-descriptor>
              > > > > > >
              > > > > > > <reference-descriptor>
              > > > > > > <resource-description>
              > > > > > > <res-ref-name>jdbc/wlPool</res-ref-name>
              > > > > > > <jndi-name>weblogic.jdbc.pool.wlPool</jndi-name>
              > > > > > > </resource-description>
              > > > > > > </reference-descriptor>
              > > > > > > <enable-call-by-reference>False</enable-call-by-reference>
              > > > > > > <jndi-name>device.StartHome</jndi-name>
              > > > > > > </weblogic-enterprise-bean>
              > > > > > >
              > > > > > >
              > > > > > >Am I doin any mistake in this?
              > > > > > >
              > > > > > >Any one's help is appreciated.
              > > > > > >Thanks
              > > > > > >Suresh
              > > > > >
              > > > >
              > > > >
              > > >
              > > >
              > >
              > >
              >
              >
              

  • This operation is not available for read only field 'Type MVF'

    Hi All,
    We are using OrderToCash PIP and we are on Siebel 8.1X.
    While Synching the customer from Ebiz to Siebel facing the following issues:
    Method 'WriteRecord' of business component 'Account' (integration component 'Account') for record with search specification '[Row Id] = "2d3434313239353"' returned the following error:"This operation is not available for read only field 'Type MVF'.(SBL-DAT-00402)"(SBL-EAI-04451)
    Please suggest us what steps to be done in Siebel.
    Thanks
    Maanasa

    First check the process why this is calling Account BC WriteRecord(). The field "Type MVF" might be read only and this sync process is trying to update this field which is read only. This is the reason for the error. Check the OM log / EAI Obj Manager Comp log (set log level to 5) and check.
    Joseph Arul Dass

  • Tabular Form Read Only Date Picker

    Hello,
    I have two or three Items with date pickers and do not want to implement
    this code because it will be too many buttons on my form. I need to clear one item
    at a time when the datepicker is readonly but, in a tabular form.
    function f_clear_items()
        {$x('P1_ITEMA').value = ''};
        {$x('P1_ITEMB').value = ''};
        }Then once I create a url button and pass this function I can clear the datepicker's. But, I
    was wondering is there a cleaner way to this.
    I have other items on the page that are named the same but, in different tables. I only want
    to clear each date picker item at a time. This code works fine for a regular form.
    -Element Post Element Text for the Item to Clear
    a href="javascript:setValue('P1_ITEMA','');">Clear Date</aThere is a thread named 'How to clear a read only page Item...?' that states how this code works but, does not
    work for a tabular form in a Master Detail page. There is a link on side the Date Picker to clear item specified but, in a tabular form Item, there is no Element tab, any ideas on how to clear a readonly date picker item using a tabular form
    and not using a button for each item, thanks in advance. I am using Application Express 3.2.0.00.27.

    Dan,
    I totally understand your point of view. So, this tabular form aspect was not tested once the Clear Date link was discovered to clear a Read Only date field. Yes, using a button to clear a date is great but, I do not want to clear every date or specified item with the click of one button for this application. It is very useful but, not for my needs at the moment.
    Basically, if a date is selected and it needs to be cleared out you can just delete the value. But, if the date is readonly you can not clear/delete the date value unless you have the Clearing functionality for a particular item using the datepicker. It may not be worth the trouble Dan like you state by adding this extra code to the calender. If an invalid date is entered an error will appear anyway.
    Thanks alot Dan for expanding my mind and showing me some JQuery and providing me with this link to do some further research if needed, thanks again.

  • Enter event not triggering for read-only checkbox

    I have some objects in a form that get "locked" when the user signs the form.  I'm not using the digital signatures.  Instead, when the user types their name into the signature text field, a script runs on the change event that makes all of the fields in the form read only.  It also unlocks the fields if the signature is deleted.
    I was worried that we would get a lot of phone calls with users that didn't understand that the form had locked ("Why doesn't this form work?!"), so I added some code to the enter event for all of the fields that would pop up a messagebox to explain to people trying to edit a signed form that the form was locked and that they would need to delete the signature to edit the form.
    This plan works perfect for my text fields and decimal fields.  It does NOT work at all for my checkboxes.  For some reason, the enter event is never triggered for read-only checkboxes.  I don't see any other events that would obviously work for me though.  Any ideas?
    Thanks

    Thanks, those are reasonable suggestions.
    In the first suggestion, I'm unclear about one aspect of how I would accomplish this.  I assume I would allow people to modify fields in the form, but that when they did, a msgbox would pop up that would inform them that, if they continued with this modification to a signed form, the signature would be removed.  I'm all good to that point.  But if they answered that they do not want to continue modifying that field and removing the signature, how can I code it to set the value back to what it was before the change?  Is there some method that will give me access to the value of the field BEFORE the attempted modification?  I went looking for something like $.previousvalue, but found nothing.
    I'd suggest that I could use a two-stage solution, in which I store the previous value on the enter event, and save it just in case they do not want to change the field when prompted by the msgbox, but since the enter event does not exist for checkboxes (my original problem), that seems like it won't work.
    As far as radio button suggestion, I like radio buttons very much except for one fatal flaw: they aren't (as far as I can tell) clearable.  That is a shame.  Clearly some people (like me) want both exclusivity AND clearability.  And we'd like the controls to have an enter event.  But I know I'm demanding   Anyway, as it is, I just end up having to use checkboxes and create a boatload of silly code to make them exclusive.
    Emily

  • Default value for Read-Only Picklist Field

    Hi, all--
    I would like to have a default value ("Undetermined") for the "Associated Account" read-only picklist value. I have an account record of this value for this purpose. This is because if there is no value in the field, the record will not be included in a report that includes the field. I do not want to make the field required at this point.
    Field management doesn't appear to allow any default value for read-only picklists. Does anyone know how to get around this, either at the lead record stage or at the lead report stage (without resorting to an analytic, which won't work for what we are doing)?
    Thanks.

    That's a great question. It doesn't appear as though you can select it from the typical method of Admin | Application Customization | Lead | Lead Field Setup | Associated Account.
    Have you tried creating a workflow to populate the field using Before Modified Record Saved?

  • Is it a bad idea to use a single read only Connection?

    I am developing a client/server application, where each client request executes in a separate thread. Currently i create a new Connection object for ANY database access. I am wondering if there is any advantage changing this, to use a single Connection object for read only access, but still creating new Connection objects for read/write access.
    Does anyone have any opinions on this matter?
    I am aware that if i go with this approach, and someone causes a SQL exception on the read only connection that it will be closed. Right now this appears to be the main disadvantage to this approach.

    I don't like the single, read-only connection idea.ack
    A single connection throughout the execution of the
    application has several security disadvantages. It is
    also less scalable. I've read other problems
    associated with it but I none come to mind at the
    moment.What are the security implications that you speak of?
    I think for the type of application i am developing,database security is not a concern, as all users are able to access the same tables.
    Basically in our application, the security is in the application domain, not the database.

  • Interface Using BAPI for Uploading shipment datas

    Can any1 send me the example code for Inbound Interface using BAPI for Uploading shipment datas.please kindly send me the programs which u using with BAPI

    Hi
    Except hiring (or new joinee) for all other actions you can use below Function Module.
    HR_INFOTYPE_OPERATION.
    ~~~Ganesh Kumar K.

  • How to monitor performance in Read Only data base

    Hi,
    We have a read only database that is using us to run reports against it.
    1. How can i monitor performance in this read Only database ?
    If i cant run statspack , how can i know what happened last hour for example
    in the database ?
    2. I use the glance utility to monitor the OS.
    I see that the Disk Utilization is 100% and the swap is 80%.
    Any suggestion what to do ?
    Thanks

    Hi,
    Since the database is read only its cant be done:
    clone SYS@pcrm > @spcreate.sql
    ... Installing Required Packages
    create or replace package dbms_shared_pool is
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-16000: database open for read-only access
    Thanks.

  • Why can't I use iCloud for exchange of data - like I could with MobileMe?

    Why can't I use iCloud for exchange of data - like I could with MobileMe?
    Oder auf Deutsch, warum kann ich keine Daten mehr in iCloud speichern bzw. zum Austausch bereitstellen, wie das bei MobileMe noch ging?
    Danke für die Hilfe
    Thanx in advance!

    The purpose of iCloud is to sync data between your devices.
    There is no "web address" to your files and no way to "share" them with others (except photos).

  • 17076 : Invalid operation for read only resultset

    Hi,
    I am trying to update database table through java jdbc application.
    But while running the program i am getting the error message " Invalid operation for read only resultset: updateString " with error code 17076.
    My program is given below :
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class Misc2 {
    public static void main(String[] args) {
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
    con = JDBCUtil.getOracleConnection();
    stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    String query = "select * from employees";
    rs = stmt.executeQuery(query);
    while (rs.next()) {
    String fname = rs.getString(3);
    if (fname.equalsIgnoreCase("Elmer")) {
    rs.updateString(3, "Mark");
    rs.updateString(2, "Robert");
    break;
    } catch (SQLException ex) {
    System.out.println("error code : " + ex.getErrorCode());
    System.out.println("error message : " + ex.getMessage());
    } finally {
    JDBCUtil.cleanUp(con, stmt);
    ****JDBCUtil Class****
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    public class JDBCUtil {
    public static Connection getOracleConnection(){
    Connection con = null;
    try{
    // Load the driver
    Class.forName("oracle.jdbc.driver.OracleDriver");
    //Establish Connection
    con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","ex","ex");
    }catch(Exception ex){
    ex.printStackTrace();
    return con;
    public static void cleanUp (Connection con , Statement stmt){
    // Release the resource
    try{
    if(con != null){
    con.close();
    if(stmt != null){
    stmt.close();
    }catch(Exception ex){
    ex.printStackTrace();
    Please help me to fix this issue.

    >
    But while running the program i am getting the error message " Invalid operation for read only resultset: updateString " with error code 17076.
    >
    Your result using 'SELECT *' is not updateable. Gimbal2 was pointing you in the right direction. You have to specify the columns in the select list to get an updateable result set.
    You also need to use 'updateRow()' to update the database and have a commit somewhere to keep the results.
    This code works for me. Note that I added an explicit SELECT list, the 'updateRow()' method and an explicit COMMIT.
        try {
            con = getOracleConnection();
            stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    //        String query = "select * from employees";
            String query = "select first_name from employees"; -- added explicit SELECT list
            rs = stmt.executeQuery(query);
            while (rs.next()) {
                String fname = rs.getString(1);
                if (fname.equalsIgnoreCase("Adam")) {
                    rs.updateString(1, "Mark");
                    rs.updateRow();                                    -- need this statement to actually update the database
    //                rs.updateString(2, "Robert");
                    break;
            con.commit(); -- added explicit commit for testing
        } catch (SQLException ex) {See Performing an UPDATE Operation in a Result Set in the 'Updating Result Sets' section of the JDBC Developer's Guide and Reference
    http://docs.oracle.com/cd/B28359_01/java.111/b31224/resltset.htm#i1024720
    As gimbal2 also alluded it is considered poor practice to use column numbers to perform result set operations when you don't know for certain what column a given number refers to. Before people start jumping all over that statement let me clarify it. The key part is KNOWING what column you are referencing. It is more performant to access result column columns by column number rather than by column name since the methods that take a column name call the integer method under the covers anyway but have to search the array of column names in order to get the column number.
    With your query (SELECT *) there is no way to be sure the column order is the same since the table could be redefined with the columns in a different order or certain columns having been deleted. So for performance LOOP processing column numbers are used inside the loop but those column numbers are determined by using the metadata BEFORE the loop to convert column names to column numbers.
    That way you code (BEFORE the loop) can use column names but you use a set of integer variables (one for each column) for the actual access inside the loop.

Maybe you are looking for