Why the data in the database changed

the code is like this:
private boolean dbUpdate() throws SQLException, IOException {
Connection conn = null;
try {
conn = ConnectHandle.getDBConnection();
conn.setAutoCommit(false);
PreparedStatement pstUpdate =
conn.prepareStatement("UPDATE mytable SET ID= ?, NAME=?,CONTENT=null");
pstUpdate.setString(1, this.getID);
pstUpdate.setString(2, this.getName());
if (pstUpdate.executeUpdate() > 0 && dbUpdateContent(conn)) {
conn.commit();
return true;
else {
conn.rollback();
return false;
catch (SQLException e) {
conn.rollback();
throw e;
catch (IOException e) {
conn.rollback();
throw e;
finally {
if (conn != null) {
conn.setAutoCommit(true);
ConnectHandle.freeDBConnection(conn);
private boolean dbUpdateContent(Connection conn) throws
SQLException, java.io.IOException {
if (getContent() == null)
return true;
PreparedStatement pstUpdate = conn.prepareStatement(.
"UPDATE mytable SET CONTENT = empty_clob() WHERE ID = ?");
pstUpdate.setString(1, getId());
pstUpdate.executeUpdate();
PreparedStatement pstSelect = conn.prepareStatement(
"SELECT CONTENT FROM DOC_SENDED_ARCHIVE WHERE ID = ? FOR UPDATE");
pstSelect.setString(1, getId());
OracleResultSet ors = (OracleResultSet) pstSelect.executeQuery();
if (!ors.next())
return false;
CLOB clob = ( (OracleResultSet) ors).getCLOB(1);
Writer writer = clob.getCharacterOutputStream();
writer.write(getContent());
writer.close();
ors.close();
return true;
i want to insert and update records in oracle talbe,the table contains a clob field
but it sometimes (not always ) throws sqlexception ,
java.sql.SQLException: ORA-01002: fetch out of sequence     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
     at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
     at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
     at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
     at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:1198)
     at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2400)
     at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2672)
     at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
     at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:527)
     at com.abc.MyClass.dbUpdateContent(SendedArchive.java:457)
     at com.abc.MyClass.dbUpdate(SendedArchive.java:415)
why throw this exception?
and other question is
when throw this Exception ,it execute conn.rollback(),the database should not change,but in database
the name is changed,why?

I'm not sure if this solves your problem, but I think you need to do this:
// This is your original code
//conn.prepareStatement("UPDATE mytable SET ID= ?, NAME=?,CONTENT=null");
//pstUpdate.setString(1, this.getID);
//pstUpdate.setString(2, this.getName());
// This is what I'd recommend
conn.prepareStatement("UPDATE mytable SET ID= ?, NAME=?,CONTENT=?");
pstUpdate.setString(1, this.getID);
pstUpdate.setString(2, this.getName());
pstUpdate.setNull(3, java.sql.Types.VARCHAR);You want to set that CONTENT column to a SQL null, not a Java null. - MOD

Similar Messages

  • How to use the database change notification event with an AppModule Child ?

    hi,
    I try to do the same stuff that this "How To" : [http://niallcblogs.blogspot.com/2009/06/auto-refreshing-adf-chart-objects-in.html].
    This example works fine, but I want an Application Module Root which contains the Application Module which contains the VO where there is the method processDatabaseChangeNotification.
    I have trying all the configuration possible of AppModuleRoot and AppModuleChild: Shared/Local, Local/Shared and even Local/Local ... but nothing works ...
    Can you tell me if possible, and if so ... how?
    thanks !
    (I use jdev11g)

    I don't find my reponse in the documentation....
    I have an AM Child in an AM Root like that :
    <AppModuleUsage
    Name="AppModuleChild"
    FullName="model.AppModuleChild"
    ConfigurationName="model.AppModuleChildShared"
    SharedScope="2" />
    My AM Root is Shared in the file "DataBinding.cpx" :
    <BC4JDataControl id="AppModuleRootDataControl" Package="model"
    FactoryClass="oracle.adf.model.bc4j.DataControlFactoryImpl"
    SupportsTransactions="true" SupportsFindMode="true"
    SupportsRangesize="true" SupportsResetState="true"
    SupportsSortCollection="true"
    Configuration="AppModuleRootShared" syncMode="Immediate"
    xmlns="http://xmlns.oracle.com/adfm/datacontrol"/>
    ... and the database change event notification don't work... I don't understand !

  • How to deal with the situation when the database change into ms-sqlserver ?

    Hi,dear all,
    How to deal with the situation when the database change into ms-sqlserver or other database?
    Now, i want to build a j2ee project with ORACLE ADF bc,but this project may be used in several diffrent databases for example oracle db,ms db,mysql and so on.however,if i have developer this project in jdeveloper and this project connection was config as a oracle database,and then,can this project be reused for other databases espasially including the model codes? if yes,how should i do?
    all who know how to resolve this,tell me pls,thanks.
    bruce Li,
    China
    Message was edited by:
    user526724

    Hi Paulbin,
    Do you want to supply a function-pointer to a DLL so it can call[back] your VI?  Here's how it can be done with .NET, though, that solution requires a C compiler.   A single "VI_to_function-reference" utility could handle all cases where the callback passes no parameters.  Maybe someday somebody will share that dll.
    Did you know that LabVIEW can use Events for some COM-signals change?  See pic.  (Note: DTR is not listed - - )
    Another question is another function's prototype is WORD SetTestType(WORD comHandle, bool type1, bool type2, bool type3),   I tried to use a boolean control and a Boolean to (0,1) node in labVIEW to pass parameters to CLF, I config the bool input value as U8(according to C++ bool type) and U32(according to WIN32 BOOL type), it dose not help, when I execute the VI, LabVIEW will be disappeare, it seems to be closed, I must start it again.
    Could someone has similar experience on this points?
    It's easy to crash LabVIEW misusing CLF - maybe there's another reason for the crash besides bool mis-match(?)  Do you know which "Calling convention" is required?  What type is comHandle? (where does comHandle come from?) 
    Cheers!
    Message Edited by tbd on 03-23-2007 09:34 PM
    Message Edited by tbd on 03-23-2007 09:35 PM
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
    Attachments:
    evt.jpg ‏7 KB

  • Why the lookandfeel change color randomly?

    why the lookandfeel change color randomly?
    after my API moves JDK1.4 to 1.5, the problem appeared.
    the Max/Min/Close button of JFrame also change to other style.

    yes, I have reset the Theme of MetalLookAndFeel.setCurrentTheme() to myself, but sometime it looks useless. It will use oceanTheme or myTheme randomly.
    Then I add a loop to check the current theme till it use mytheme.
    The new problem the min/max/close button changed randomly, though that is much less frequent.

  • How to know the database changes between different releases

    Where can I get the information of database changes, like for example new columns new tables, etc, between different releases?
    My goal to try to determine the current version, or is there a better way?
    Thank you

    For JD Edwards World or for JD Edwards EnterpriseOne - you can go to upgradejde.com Once this screen comes up, pick Resources. You will then have an option to take JD Edwards EnterpriseOne or JD Edwards World. On the next screen, you can select the tab Compare Releases. This will allow you to enter the release that you are currently on and enter the latest GA release of software. You will then see all the differences between your current release and the release you should upgrade to. You can also format this into a printed report.

  • Why the Colour changes in AI ???

    My friend had a PDF file created in AI. She gave me the PDF file only. I open the file with AI in order to do minor editing but when I copy this file and paste into a new AI document, the colour changes (it becomes darker) even both documents are in CMYK mode. (I am using Adobe Illustrator CC)
    The same file my friend gave me, I did the same with Adobe Illustrator CS5, there is no problem.
    Can anyone help? Thank you so much in advance.

    I understand that for an export operation, but still puzzled why the histograms are almost identical in LR for images that had been brought into PS from the same RAW file and converted to different spaces (with slight differences undoubtedly due to the different gamuts).   In that case, LR must be "honoring" the different color spaces, with the same appearance and histograms...  But when I soft-proof the same RAW file I get very different histograms -- the sRGB more stretched out than the ProPhoto one.  Those soft-proof histograms are "the same" (realizing they are all quick calculations) as when I do the corresponding convert to profile in PS.
    Maybe I'm not getting my head around "the histogram of the proof target."  That would be the more "dramatic" (changed) histogram I'm seeing in LR's soft proof and PS's convert to profile.  But is there a reason to show it that way?  Doesn't a histogram need to be interpreted in a color space to be meaningful?
    If I go ahead with something like a Save for Web or Export from LR in that target color space, I'll then see the histogram return to more or less what it was before (given that rendering intent has done its thing).
    Is it that the more dramatic histogram is simply representing the image in the wrong color space??  I can see that as a pragmatic decision.

  • Why the database, listener and asm are offline automatically

    I just install two nodes RAC on vmware, everything is OK. After I install database, I find, the system is not stable. I use the command
    "crs_stat -t" , everything is online, however, after a while, database instances, asms or listeners go often offline automatically.
    So, I have to use "srvctl start database -d" to start the database, after that, everything is online again.
    why is that? Anybody met the same situation before? Did I forget some important parameter?
    thanks

    check the crsd and cssd log file .
    also upgrade you clusterware,asm, db_home to 10.2.0.4.

  • Why the cursor changes only after moving the mouse?

    I have used the setCursor() on a JInternalFrame to change the image of the cursor. I change the cursor to Cursor.WAIT_CURSOR and back to Cursor.DEFAULT_CURSOR in a new thread. Then the only way for the cursor to change from WAIT to DEFAULT is to move the mouse, otherwise it will remain in WAIT status. What's going wrong?

    I am using version 1.1.2 in JBuilder1. I have an extended Dialog as an interface to change the Oracle Password. When the OK button is selected to complete the process of accessing the DB to make the change, I change cursor to the wait cursor before the DB is accessed. I have to move the mouse to trigger the cursor change to wait. I would think there would be an efficient way to do this. I would also appreciat some help. I'm not sure if this is a problem in later versions.
    Thanks,
    Mike

  • Data Modeler Incremental Database Changes

    We need the tool to determine the differences between the database and the model, so that it generates DDL only for the changes without us having to tell the tool at DDL creation time which are the new tables, columns, indexes, etc. Is this feature available already or would this be a new feature?

    Hi,
    Yes, this feature is already available.
    If the model was initially imported from the database, you can use Synchronize Data Dictionary with Model (either for individual objects, or for the whole model using the right-pointing arrow above the diagram).
    This displays the Compare Models dialog identifying the differences. You can use its DDL Preview button to generate DDL to update the database.
    There's a short video demonstrating this at http://apex.oracle.com/pls/apex/f?p=44785:24:689545084496101::NO:24:P24_CONTENT_ID,P24_PREV_PAGE:5951,2
    If the model was not imported from the database, you can do the following:
    Open your model (including the relevant Physical Model).
    Use Import/Data Dictionary to start the Data Dictionary Import Wizard. In step 2, select the "Swap Target Model" tick box. And select the relevant objects to import from the database.
    After the import phase, this will display the Compare Models dialog as in the previous case.
    There is now a forum specifically for Data Modeler topics: SQL Developer Data Modeler
    David

  • Link between loss of datafiles and shutdown of the database

    Hi all,
    I'm new to Oracle and I'm trying to understand how Oracle works.
    I'm actuaally learning Oracle Backup and Recovery Advanced User's Guide 10g Release2, and at chapter19 of this guide, it's written that if either a permanent or temporary media failure affects any datafiles of a database operating in NOARCHIVELOG mode, then the database automatically shuts down, but that a database operating in archivelog mode doesn't shut down in the case of media failure  if its datafiles affected by the media failure are not in the SYSTEM tablespace or do not contain active rollback or undo segments.
    I don't understand why the database in archivelog mode doesn't shut down in the case of a media failure affecting datafiles not in the SYSTEM tablespace or not containing rollback or undo segments, whereas the database in noarchivelog mode shuts down in the case of a media failure causing loss of datafiles.
    Please, can I have some explanations on it?
    Thanks.

    The guide supposes (and this is very important) that you have consistent backup of the database and all archived logs since that backup if it's in ARCHIVELOG mode.
    If the database is in ARCHIVELOG mode and you have backup, any normal lost datafile can be recovered with the database staying online, lost datafiles are just automatically taken offline and then you take the tablespace they belong to offline with temporary option, restore lost datafiles, recover the tablespace (using archived logs as needed) and put it back online. However, if media failure affects critical database structures like active undo or SYSTEM tablespace, Oracle instance can't stay online because you can't take SYSTEM tablespace or a tablespace with active undo segments offline, thus it automatically aborts. You then perform offline database recovery.
    In NOARCHIVELOG mode your only recovery option after any media failure is to restore the last consistent backup and lose all changes performed since then. There's no point for the instance to continue running in this case, so it aborts.

  • Oracle 10g XE - unable to connect to the database home page

    Hi,
    I have installed Oracle 10g XE on my computer. When I try to open the Database home page at http://127.0.0.1:8080/apex, I get a Page not found error.
    I have followed the steps outlined in the forums-
    a) did "netstat -a"
    Output : found that port 8080 isn't being used.
    b) did "lsnrctl status"
    Output: under Services summary - instance "CLRExtProc" is unknown
    - instance "PLSExtProc" is unknown
    - instance "xe" is ready
    - instance "xe_xpt" is ready
    c) did "sqlplus / as sysdba"
    Output : Connected to Oracle 10g Express Edition
    d) did "select status from v$instance "
    Output : Mounted
    e) did "select open_mode from v$database"
    Output : Mounted
    f) did "startup"
    Output : started the database
    Not sure why the database home page still wouldn't open. Any help is appreciated.

    Hi,
    >>What is the command to change the status to "READ WRITE" ?
    C:\>sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 29 00:26:33 2008
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to an idle instance.
    SYS@XE> startup mount
    ORACLE instance started.
    Total System Global Area  188743680 bytes
    Fixed Size                  1286460 bytes
    Variable Size              92278468 bytes
    Database Buffers           92274688 bytes
    Redo Buffers                2904064 bytes
    Database mounted.
    SYS@XE> select open_mode from v$database;
    OPEN_MODE
    MOUNTED
    SYS@XE> select status from v$instance;
    STATUS
    MOUNTED
    SYS@XE> alter database open;
    Database altered.
    SYS@XE> select open_mode from v$database;
    OPEN_MODE
    READ WRITE
    SYS@XE> select status from v$instance;
    STATUS
    OPENCheers
    Legatti

  • Entity Bean Rollback fails: caches are out of synch with the database

    We are encountering a critical issue where the rollback of a session transaction rolls back any database changes, but doesn't roll back bean changes in memory. When we next access the bean, it returns information that should have been rolled back. The memory cache is out of synch with the database.
    We have a simple session bean S, using container managed transactions. We also have an entity bean E using bean managed persistence. E has a single member <name>.
    We implement a method s() in S with <trans-attribute> Required as follows:
    public void s() {
    Context lookupContext = getLookupContext();
    SHome shome = (SHome) lookupContext.lookup(SHome.NAME);
    S s = shome.findByPrimaryKey(thePrimaryKey);
    System.out.println("-- current name = " + s.getName());
    s.setName("IGNORE");
    EJBContext ejbContext = (EJBContext) getContext();
    ejbContext.setRollbackOnly();
    Since this is BMP, the setName call issues our SQL update against the S record. When the session transaction rolls back, the database changes are also rolled back. But the entity bean in memory shows the modified name. We can see this in the next call to s() since the getName() returns IGNORE rather than the original value. We have also gotten debugged into the underlying instance cache associated with the S bean descriptor. I.e.
    AbstractEJBHome ejbHome = (AbstractEJBHome) lookupContext.lookup(SHome.NAME);
    AlternateHashTable aht = ejbHome.getBeanDescriptor().getCache();
    Looking at this map of bean instances also shows that the bean instance for S is not rolled back.
    From previous conversations with the server technologies team, we understand that during the transaction, we should be working on a cloned copy of the S bean. Upon rollback, the copies should be discarded rather than merged back to the cached bean. They seem to be merged regardless of rollback state.
    We are using OC4J 10.1.3.0.0 (build 060119.1546.05277).

    Actually, what one or the developers in my group found out is two things:
    1) The clone is a shallow copy.They copy the references but not objects themselves. This has been causing problems for us.
    2) It seems that you don't work on a copy and you work on the original and they keep a copy. Now, this is fine IF you don't have multiple threads working on the same Entity bean and we moved our application from Weblogic where it throws an exception if that Entity bean is in use to OC4J which is suppose to copy the bean and doesn't so you have multiple threads possibly modifying the same object.

  • How to know what are the db changes done today

    Is there any way to know the Code changes done today in a schema. Code changes means any ddl commands / function changes / procedure changes / triggers etc. .
    Edited by: DIVI on May 29, 2012 10:08 PM

    Hi,
    If you are need of the DB Changes for which a DB Objects are Created then,
    you can use.
    SELECT *
      FROM USER_OBJECTS
    WHERE OBJECT_TYPE IN ('TABLE', 'PROCEDURE', 'PACKAGE', 'FUNCTION');But, If You need to Track Entire DDL Activites, You have to Audit the Database Changes or
    with the Use of Database Triggers.
    Thanks,
    Shankar.

  • How to port database changes from development to a production environment

    How do I port database changes from the development to the production environment?
    I am using v8 and have always had to redo everything using the schema manager all over in the production environment. Is there an easy way to generate a script, for example to dump the database changes on the development machine to be executed later on the production machine?

    This should already be a clearly defined change control process. Once a procedure, function, package, trigger, or whatever completes the testing rounds, it should be promoted to production.
    Forgive me if it seems I'm trivializing, but I don't see the problem, just copy the object(s) from your software library (or development) into production using whatever tool works best or has been chosen. If you are doing data copies then you have various options again including good old export/import.

  • Database change in production system

    Hi Experts
                I have created a ztable and transported to production system.
               Now i need to delete one column, or change the data element and domain, is it possible, will it create any problems.
            if data already exists for a particular field in production system, now can i change the data element and domain without losing the data.
               Pls help me on this, and give any notes about the database changes after transported to producion system.
    Regards
    Rajarm

    Hi..
    I tried this..
    If  u rename a field or changes occuring to a paricular field means..
    The corresponding field data will be deleted..
    Post me for furthur Queries regarding this.
    Regards
    Bala..

Maybe you are looking for

  • Toshiba C675-S7200 Stuck on Toshiba Splash Screen

    When trying to boot the laptop up it freezes as the "Toshiba Inspiring Innovation" spasl screen... I removed the HDD and it will boot up into the BIOS, however when I reconnect the HDD it refuses to boot up past the screen again, nor will it show the

  • Mac Book (Black) and Final Cut 5.

    I'm about to buy a Black Mac Book and am hearing conflicting reports. Will it run Final Cut 5 HD ? Mac Book   Mac OS X (10.4.8)  

  • Jw player pop up ads

    I've noticed the last couple weeks this ad player was in background playing videos now it is in forefront and it is driving me crazy! I've reset Firefox, I've deleted and reinstalled but all the info for my bookmarks and things are still here even th

  • IOS 7 error message??

    Everytime I try to download ios7 it says error and stops almost immediately.. whats wrong? I've tried restarting my phone, that did nothing.

  • Automatic renaming of clips after linking....

    Working on a Dual System production, where I roughly line up the videofiles (EOS 5D converted to ProRes LT) including guide audio with the multitracked audiofiles (poly). Sync using Plural Eyes, and some manually. After sync is matched, I link the vi