JDBC and Hung Update Operations

Hi,
I am learning JDBC interface in Java with Oracle database and have noticed a strange problem when I perform simple update (i.e. insert) operation (using bind variable of PreparedStatement).
I am currently running Oracle database version 9.2.0.1.0 on Solaris 10 with my client program running on JVM Sun 1.5 with JDBC ojdbc5_g.jar. The database instance runs on Solaris OS and the JDBC thin driver is run on either Windows or Linux in an internal LAN network (using TCP). I can connect and perform queries from my JDBC code just fine; I can also perform the usual operation from SQL*Plus on my database hosting machine as well as remotely on the machines that I run the JDBC code using SQL*Plus client.
Now, if the JDBC code attempts to perform a modification operation AND any a user connected to the database through SQL*Plus also performs some sort of update operation on the "same" table that the JDBC code is trying to modify, then the JDBC code hangs. The two operations are being performed at various times. Just to give you a scenario in which the code does or does not become responsive:
If I login via SQL*Plus and connect to the database but perform solely "select" statements on my designated table, and run the JDBC updating code, everything works fine. The insert is done accordingly even in the subsequent updates via JDBC as long as the SQL*Plus user performs only "select" queries.
As soon as I perform a modification operation (i.e. delete the inserted row by the JDBC code) in SQL*Plus, any subsequent attempts to, let's say insert a row, by the JDBC code would result in an operation to hang (just to note, I can acquire the connection in this scenario but the actual execution of operation from JDBC hangs, no response) -- even if I wait half an hour and run my JDBC program, the operation hangs.
The strange thing is, to remedy this, a user that has performed some sort of modification operation on the table via SQL*Plus has to "disconnect" from the database. As soon as the SQL*Plus user disconnects, the JDBC operation goes through and program successfully performs the update
By the way, I am also utilizing DataSource in my code (without JNDI) to establish connections but I've tried the DriverManager in my code with the same result. One last remark is that the isolation level has been set to READ COMMITTED if that has anything to do with it (but the thing is neither of updating operations from JDBC or SQL*Plus are being done at the same time -- as I've mentioned, I even waited a few minutes between each run). Perhaps, the SQL*Plus holds a luck on the rows of the table for some reason and once the user disconnects, the JDBC program goes through shrug
Any hint would be appreciated.

The issue is that by default, a SQL-PLUS session operates in
'autocommit false' mode, so when you do any sort of update,
your SQL-PLUS session has a transaction and will hold an
exclusive lock on anything you've updated, until you commit,
or disconnect. The JDBC session, or any second separate
concurrent SQL-PLUS session will also be blocked.
Joe Weinstein at BEA Systems

Similar Messages

  • JDBC and using update statements

    I have a program that connects to a microsoft access DB using JDBC-ODBC Bridge, but i dnt know how to write a correct update statement. I use servlets & it should call a function that retrieves a specific value, adds 1 to that integer value and updates the DB,but it didn't work. i also need to know how to delete all records in a DB.
    Thanks in advance

    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.sql.*;
    public class first_count extends HttpServlet {
       private Statement statement = null;
       private Connection connection = null;
       private String URL = "jdbc:odbc:rjdemo";
       public void init( ServletConfig config )
          throws ServletException
          super.init( config );
          try {
      Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
          connection =DriverManager.getConnection( URL, "", "" );
            }//try
           catch ( Exception e )
             e.printStackTrace();
             connection = null;
          }//catch
       public void doPost( HttpServletRequest req,
                           HttpServletResponse res )
          throws ServletException, IOException
          String cnt;
          cnt = req.getParameter( "big" );
    //takes the parameter of a radio button in a form
         PrintWriter out = res.getWriter();
          res.setContentType( "text/html" );
         if ( cnt.equals("big1"))
    //if the value of the radio button equals big1
             int i=0;
             out.println("The number retrieved = " + big_counter(i));
                      }//if
            out.close();
    int big_counter(int i)
          try {
             i=0;
             statement = connection.createStatement();
             ResultSet r= statement.executeQuery("select beg_count from User");
             r.first();
             i=r.getInt("beg_count");
    //the name of column is beg_count it's a number
             i++;
             statement.executeUpdate("UPDATE User SET beg_count="+i);
             statement.close();
          }//try
          catch ( Exception e )
          }//catch
    return i;
       public void destroy()
          try {
             connection.close();
          catch( Exception e ) {

  • Update Operation to SAP Failed using BDC Model

    Hi All,
    I am working in Duet Enterprise 1.0 development in SharePoint. At SAP front Query, Read and Update operations have been developed and the corresponding WSDL and Endpoint URLs are generated.
    I need to use these WSDL and Endpoint urls and perform Update operation in SharePoint. For this I need to pass the parameters POSCLKey, CorrelationID, ReleaseCode and PONumber for the update operation.
    I have written the following code:
     using (new Microsoft.SharePoint.SPServiceContextScope(SPServiceContext.GetContext(site)))
    BdcService service =
    SPFarm.Local.Services.GetValue<BdcService>();
                            IMetadataCatalog
    catalog = service.GetDatabaseBackedMetadataCatalog(SPServiceContext.Current);
    //IEntity entity = catalog.GetEntity(ConfigurationManager.AppSettings["NameSpace"], ConfigurationManager.AppSettings["EntityName"]);
    IEntity entity = catalog.GetEntity("http://bccplmoss:9999",
    "Purchase Order V1");
    foreach (KeyValuePair<string,
    IMethod> methods in entity.GetMethods())
    ILobSystemInstance LobSysteminstance = entity.GetLobSystem().GetLobSystemInstances()[0].Value;
    IFieldCollection fieldCollection = entity.GetUpdaterView("UpdatePO").Fields;
    IMethodInstance methodInstance = entity.GetMethodInstance("UpdatePO",
    MethodInstanceType.Updater);
    string Relcode = "V1";
    //string[] parameters = { "1022_7400000011_ZPURCHASE_ORDER_HEADER_SPI_SERV_160", "7400000011", Relcode };
    Identity identity = new
    Identity("1022_7400000011_ZPURCHASE_ORDER_HEADER_SPI_SERV_160");
    IMethodInstance methodinstance = methods.Value.GetMethodInstances()[methods.Key];
                               IEntityInstance
    entityinstance = null;
    entityinstance = entity.FindSpecific(identity, LobSysteminstance);
                                entityinstance.Update();
    Error Details Are:
    Error Occurred in the following line:
    entityinstance = entity.FindSpecific(identity, LobSysteminstance);
    Error Description:  The shim execution failed unexpectedly - The incoming policy could not be validated. For more information, please see the event log..
    Is there any Alternate Method to update the data into SAP through BDC model? Please suggest me at the earliest.
    Thanks & Regards,
    Murali Krishna Tatoju
    Best Regards, Murali Krishna Tatoju SAP Duet Developer

    Hi all,
    Now we are able to pass all the required input data to the update operation
    and no errors exist for this operation. But when we execute the update operation, the PO is not getting updated at SAP. But same operation
    is working fine from DUET-ABAP. As a test, we executed this operation from DUET ABAP front and generated the log (/iwfnd/view_log) log
    has been generated. The same operation when we executed from Sharepoint and when we looked into 14-hive logs, nothing has got generated
    for update operation. 
    Note: when executed this update operation from SharePoint, in /iwfnd/view_log, no logs generated for updated operation.
    Please suggest me a way so that I can sort out this issue.
    Best Regards, Murali Krishna Tatoju SAP Duet Developer

  • Mac won't update software or access iTunes shop. Message comes up with 'not connected to the net. Check connections' error. I still have internet access. Changed my Apple ID but no result. Repaired permissions and re-installed operating system.

    Mac won't update software or access iTunes shop. Message comes up with 'not connected to the net. Check connections' error. I still have internet access. Changed my Apple ID but no result. Repaired permissions and re-installed operating system.

    It sounds like you may have multiple problems, but none of them are likely to be caused by malware.
    First, the internet-related issues may be related to adware or a network compromise. I tend to lean more towards the latter, based on your description of the problem. See:
    http://www.adwaremedic.com/kb/baddns.php
    http://www.adwaremedic.com/kb/hackedrouter.php
    If investigation shows that this is not a network-specific issue, then it's probably adware. See my Adware Removal Guide for help finding and removing it. Note that you mention AdBlock as if it should have prevented this, but it's important to understand that ad blockers do not protect you against adware in any way. Neither would any kind of anti-virus software, which often doesn't detect adware.
    As for the other issues, it sounds like you've got some serious corruption. I would be inclined to say it sounds like a failing drive, except it sounds like you just got it replaced. How did you get all your files back after the new drive was installed?
    (Fair disclosure: I may receive compensation from links to my sites, TheSafeMac.com and AdwareMedic.com, in the form of buttons allowing for donations. Donations are not required to use my site or software.)

  • The Creative Cloud application becomes inoperable continually on both my Windows 7 and 8.1 operating systems. I'm tired of re installing the application after deleting the OOBE file to get updates and syn settings between computers for Photoshop. Is this

    The Creative Cloud application becomes inoperable continually on both my Windows 7 and 8.1 operating systems. I'm tired of re installing the application after deleting the OOBE file to get updates and syn settings between computers for Photoshop. Is this an endemic problem with others? I'm using Google Chrome as my browser. Is this an issue with the problem?

    Similar problem just happened to me with the Creative Cloud Update 1.7.1.418—slightly different so I thought I'd share. I have multiple Adobe Creative Cloud programs installed on my computer, all working just fine. I updated the Cloud App to the latest version and then it shows me that I have only one program installed! All my previously installed programs (Photoshop and the like) still work but show as "install" instead of "Up to date". Initially I thought I'd have to re-install the Cloud app or recreate the OPM data base but then I noticed that some of the Cloud app preferences (Apps > Settings > App Language) were different to what I had set previously. I use English (International) language, the update had reverted the app back to English (North American). I flicked back to my previous language and bam, all my apps now show as being installed correctly.

  • The browser Working very slowly at the first time open or when i open a new link And not as well as by And I have Operating system xp sp3 Updated

    the browser Working very slowly at the first time open or when i open a new link
    And not as well as by
    And I have Operating system xp sp3 Updated
    And i get Stop in the script

    '''I fixed mine by removing the Ask.com extension.'''
    Tools
    Add-ons
    Settings icon
    View Recent Updates
    Ask.com '''DISABLE'''
    Running FF 8.0 on Windows 7 (64-bit)

  • I have Mac OS X Version 10.6.8 ,I want to buy the updated operating system that puts iMessage and Facetime on my Macbook Pro. What should I search for, and then purchase, in the App Store?

    I have Mac OS X Version 10.6.8 ,I want to buy the updated operating system that puts iMessage and Facetime on my Macbook Pro. What should I search for, and then purchase, in the App Store?

    FaceTime can run in the version of OS X that you currently have. To get Messageyou need Mountain Lion. The protocol used by Messages is iMeassage.
    The question is does your MBP meet the specs for Mountain Lion.
    iMac (Mid 2007 or newer)
    MacBook (Late 2008 Aluminum, or Early 2009 or newer)
    MacBook Pro (Mid/Late 2007 or newer)
    MacBook Air (Late 2008 or newer)
    Mac mini (Early 2009 or newer)
    Mac Pro (Early 2008 or newer)
    Xserve (Early 2009)
    Your Mac needs:
    OS X v10.6.8 or OS X Lion already installed
    2 GB or more of memory
    8 GB or more of available space

  • TS1702 I am updating my IPAD to version 5.1 and the update has stopped before completion. What is the procedure. If I stop the update or restart the IPAD will the update be corrupted and also the IPAD operating system.

    I am updating a new IPAD to the latest version from ITUNES. The update is not complete and has stopped. What  is the procedure to restart? If I close ITUNES i get a message that the IPAD is updating. Will closing the application cause the update to be corrupted and thus the operating system? Will the same occur if I power the IPAD down or disconnect it vis the USB port?
    Help!!!

    routnom wrote:
    AppleWill - when i closed the app and restarted Itunes, I had to go thru a Restore process. The restore goes to certain point and stops. It seems at the same time as the Update stopped. I can Force a stop and reboot the computer and try again. It possible the screensaver interrupted the restore? It doesn't sound right. Any suggestions?
    You may also want to go to:
    ~/Library/iTunes/
    This is done by  going to the "Go" in the Finder and select Go To Folder. Copy and paste:
    ~/Library/iTunes/
    In to Go To Folder selection. Look for a folder called iPad Software Updates. Delete anything in that folder and re download the upadate.

  • Since this morning when I try Software Updates and then Updates, I get a consistent message - An Error has occurred, The operation couldn't be completed. (NSURLErrorDomain error - 1012). Is this a server error and what do I do next?

    Since this morning when I try Software Updates and then Updates, I get a consistent message - An Error has occurred, The operation couldn't be completed. (NSURLErrorDomain error - 1012). Is this a server error and what do I do next?
    Please help!!!!!

    Wait until Apple fixes this server issue.
    Best.

  • Do SQL pros write seperate stored procedures to handle Save and update operations?

    hi friends,
    Currently i'm bit confused with the industry standard of writing store procedures for save and update operations. I have sees people write separate stored procedure to handle save and update operations even they have to write complex queries. Also I have
    seen people writing one store procedure to handle both Save and Update operations even when the queries are complicated. when I asked them why they do it, they said why should waste time on writing another query to update instead write one save store procedure
    to handle all.
    In here there are SQL Pros, Gurus, what would say about this?
    what is the actual industry standard with stored procedure to perform save and update operations, do you write separate ones or do both in one?
    thanks
    I use Visual studio 2012 Ultimate and SQL server 2008 developer edition!

    >what is the actual industry standard with stored procedure to perform save and update operations
    There is no industry standard. Guideline though you want to be happy with the sp-s; same for your peers.
    As noted above the MERGE command is like a Swiss Army knife; it can perform INSERT, UPDATE & DELETE
    in one (huge) statement.
    Make sure you pick good names for the sp-s, document the parameters and comment the logic if any.
    Format the stored procedure for readability:
    http://www.sqlusa.com/sqlformat/
    Kalman Toth Database & OLAP Architect
    SELECT Query Video Tutorial 4 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • HT1338 attempting to update operating system software on Macbook Pro with OSX 10.4.11 what is the cost and how

    attempting to update operating system on macbook pro with osx10.4.11.
    how is this accomplished and what is the cost ? is the worth the expense give the age of unit?

    Start by checking if you can run Snow Leopard:
    Requirements for OS X 10.6 'Snow Leopard'
    http://support.apple.com/kb/SP575
    OS 10.6 Snow Leopard is once again available from the Apple Store:
    http://store.apple.com/us/product/MC573/mac-os-x-106-snow-leopard
    and in the UK:
    http://store.apple.com/uk/product/MC573/mac-os-x-106-snow-leopard
    but nobody knows for how long it will be available.
    To use iCloud you have to upgrade at least to Lion, but some functions are only available in Mountain Lion:
    http://support.apple.com/kb/HT4759
    You can also purchase the code to use to download Lion (Lion requires an Intel-based Mac with a Core 2 Duo, i3, i5, i7 or Xeon processor and 2GB of RAM, running the latest version of Snow Leopard), or you can purchase Mountain Lion from the App Store - if you can run that:
    http://www.apple.com/osx/specs/
    When you have installed it, run Software Update to download and install the latest updates for Snow Leopard.

  • The new ibook app and ibook update is designed for iPhone 5 operating system.   When my iPhone4 recently updated the ibook app, it created many problems using the ibook to download and read my books.    Can I get the previous ibook app back on my phone.

    The new ibook app and ibook update is designed for iPhone 5 operating system.   When my iPhone4 recently updated the ibook app, it created many problems using the ibook to download and read my books.    Can I get the previous ibook app back on my phone.

    Check your trash can on the desktop. The old version is automatically moved to the trashcan. You should be able to move it from the trashcan back to the Apps folder within the iTunes folder. The update that was pushed out was for iBooks to work with iOS 7 not iPhone 5. iOS 7 was released today.

  • SUP 2.0 Update operation Failing

    Been banging my head against the wall with this all day:
    I have an MBO that joins two tables together - sales_order_items and product - from the sampledb
    I have an update operation that runs fine standalone, but fails to execute when I try to test it in the MBO test execute wizard.
    here is the sql for the update:
    UPDATE sales_order_items soi, product p
       SET p.name = :name,
           p.description = :description,
           soi.quantity= :quantity,
           soi.ship_date= convert(varchar, :ship_date, 121)
    WHERE soi.prod_id = p.id
       AND (soi.id = :id)
       AND (soi.line_id = :line_id)
       AND (p.name = rtrim(:old.name))
       AND (p.description = rtrim(:old.description))
       AND (soi.quantity = :old.quantity)
       AND (soi.ship_date = convert(varchar, :old.ship_date, 121))
    It is failing with the following (from the workspace debug window):
    java.lang.RuntimeException: Failed to execute EISOperation.
            at com.sybase.uep.tooling.eis.BaseEISOperation.execute(BaseEISOperation.java:283)
            at com.sybase.uep.tooling.eis.BaseEISOperation.execute(BaseEISOperation.java:165)
            at com.sybase.uep.tooling.eis.JdbcEISOperationImpl.execute(JdbcEISOperationImpl.java:190)
            at com.sybase.uep.tooling.ui.dialogs.preview.ExecuteSection.getRecordSet(ExecuteSection.java:289)
            at com.sybase.uep.tooling.ui.dialogs.preview.ExecuteSection.access$300(ExecuteSection.java:75)
            at com.sybase.uep.tooling.ui.dialogs.preview.ExecuteSection$3.run(ExecuteSection.java:192)
            at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
    Caused by: com.sybase.vader.da.jdbc.MinCheckAffectedRowCountException
            at com.sybase.vader.da.jdbc.JdbcCheckAffectedRowCount.execute(JdbcCheckAffectedRowCount.java:27)
            at com.sybase.vader.service.interaction.PipelineCompositeInteractionOperation.execute(PipelineCompositeInteractionOperation.java:55)
            at com.sybase.uep.tooling.eis.BaseEISOperation.execute(BaseEISOperation.java:265)
            ... 6 more
    I read that the EIS data source and the MBO attributes need to have the same character length and I have confirmed that this is the case. Still failing.
    Does anyone have any ideas on what the issue is?

    I'm getting exactly the same error.
    What do you mean by a stored procedure? How do you pass the parameters from the UPDATE operation to the stored procedure?
    Anyway I don't see why this is failing... It's an error known by Sybase, I found it here:
    [http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc01206.0200/doc/html/mqu1254774265030.html]
    But I don't understand the explanation of the error that they give...
    Can anybody help me?

  • Problem whit Update Operation, Error UPDATE_ROW_CONFLICT with Oracle DB

    Hello friends!, I have a problem whit UPDATE Operation with a Oracle DataBase, but it is rare because it works in "Java Sun Application Server" and not in Tomcat (5.5.12) , displaying the following error:
    "Error :Number of conflicts while synchronizing: 1 SyncResolver.UPDATE_ROW_CONFLICT row 5 values changed in database"
    part of the file log:
    "SEVERE: Error Description
    java.lang.RuntimeException: Number of conflicts while synchronizing: 1 SyncResolver.UPDATE_ROW_CONFLICT row 5 values changed in database
         at com.sun.data.provider.impl.CachedRowSetDataProvider.commitChanges(CachedRowSetDataProvider.java:878)
         at ido02004.EditPerson.saveButton_action(EditPerson.java:519)
    For any change of columns for table in Data Base.
    The code used in the page (EditPerson.jsp) is:
    public void init() {
    Object pid = getSessionBean1().getCurrentPersonId();
    RowKey personRowKey = ido_personsDataProvider.findFirst("PERSON_ID", pid);
    ido_personsDataProvider.setCursorRow(personRowKey);
    public String saveButton_action() {
    try {
    ido_personsDataProvider.setValue("USER_ID", userDD.getSelected());
    ido_personsDataProvider.setValue("STATUS", statusDD.getSelected());
    ido_personsDataProvider.setValue("NAME", name.getValue());
    ido_personsDataProvider.setValue("FUNCTION", function.getValue());
    ido_personsDataProvider.setValue("ADDRESS", address.getValue());
    ido_personsDataProvider.setValue("EMAIL", email.getValue());
    ido_personsDataProvider.setValue("PHONE", phone.getValue());
    ido_personsDataProvider.setValue("VALUATION", valuation.getValue());
    ido_personsDataProvider.commitChanges();
    catch (Exception ex) {
    log("Error Description", ex);
    error("Error :"+ex.getMessage());
    return null;
    Please, Some idea of why gives the error? Help!
    Thanks in advance!
    Ren�
    P.D. Excuse my English.

    Hi All!
    New Info:
    System.out.println(" date created : "+ido_personsDataProvider.getValue("DATE_CREATED"));
    System.out.println(ido_personsDataProvider.getCachedRowSet().getMetaData().getColumnClassName(13));When these lines are printed in Java Sun Application Server for JSC show this:
    [#|2006-05-05T17:12:50.264-0500|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=15;|
    date created : 2006-04-24 00:00:00.0|#]
    [#|2006-05-05T17:12:50.264-0500|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=15;|
    java.sql.Timestamp|#]
    When these lines are printed in Tomcat show this:
    date created : 2006-04-24
    java.sql.Timestamp
    Why? the values of this date is different in one or another server. Problem of driver JDBC? I use driver: to ojdbc14.jar, in Tomcat for the connection to the BD Oracle. Maybe this originates error UPDATE_ROW_CONFLICT...
    Please, any idea?
    Thanks!

  • Statement caching and batch update

    Can these 2 JDBC features work together ?
    Is it possible while statement is cached to be reparsed (soft) if used in batch update ?
    I am asking this questions because i have a sitution where an insert is cached using implicit statement caching and then put in a batch to exeute batch updates !!! From statspack reports i find that 1/3 of statements are reparsed ... even soft !!!

    Statement caching and batch update work fine together. The most common cause of unexpected soft parses is changing the type of some parameters. If you first bind one type, setInt(1, ...), do addBatch, then bind another type to the same parameter, setString(1, ...), and do addBatch, you will get a soft reparse. There is nothing the JDBC driver can do about this, the RDBMS requires it.
    In general, whatever parse behavior you see with statement caching you would also see without it.
    Douglas

Maybe you are looking for