This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

executeUpdate not updating and no exception thrown  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using Oracle 8.1.7.4 db and Weblogic 8.1 server

It's one of those problems where I can't see anything wrong with the code, but its not updating the table and its not throwing an exception either.

Here's the code:


==========
As I watch the flow of the code in the console log, I know the code executes:

rowsUpdated = daoUtil.executeSQL(qryUpdateMDRequestHeader, params);

Right before that line, I print out the query and the params:
qryUpdateMDRequestHeader = update md_request_hdr set auth_user_id=?, auth_date=?, additional_instructions=?, pickup_inst
ructions=?, req_pickup_date=? where customer_id=? and tracking_number=? params = v050754 09/04/2006 08:58:30 None None
09/11/2006 VzEast MD5127357

I had print lines in the executeSQl as well and know it was reaching there as well.

What I do not see is the executeSQL line " System.out.println("modified rows " + retValue);"

Nor do I ever see the "ERROR" line printout. I had also added a line to the finally of the executeSQL to print out rowsUpdated which equalled -1.

Yet the code keeps going, never throws an exception and continues the rest of the processing.

I've copied and pasted the sql into Golden32 (oracle sql program) and the query runs find with the params passed and updates the table.

Any thoughts at all as to either how I can troubleshoot this or what may be occurring?

[added code tags]
[ September 04, 2006: Message edited by: Jeanne Boyarsky ]
 
author & internet detective
Posts: 39285
727
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Debbie,
Can you confirm the value of rowsUpdated immediately before the statement:
if(rowsUpdated < 1)

Also, I don't see where rowsUpdated is declared? Can I assume it is an int?
 
debbie shifferd
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the beginning of the method rowsUpdated is defined as follows:

int rowsUpdated = -1;
 
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I had to guess, I'd say an Exception (other than SQLException) is being thrown inside the try clause before the println().

Add this code after catch(SQLException e) clause:



And run the program again.

Since you aren't catching the Exception, the Exception is passing up through the call stack until some other method catches it. This is why you don't see the ERROR and modified rows messages -- your methods don't get a chance to complete.
[ September 04, 2006: Message edited by: Scott Johnson ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same issue came by as in, my oracle connection would go upto jdbcTemplate.executeUpdate() and then nothing, no error/exception no thread to debug.
So I closed my oracle sql developer, then tried persisting, so it worked. It seems as the oracle DB is logged in by the java as Functional user and then if one has sql developer open at the same time, the oracle connection sessions seem to get overridden so sessions get locked.
There could be more to this but stopping the sql developer at the time worked and it is still working and gives error sometimes when you have stopped a java program that opened a connection but didnt yet finish before you terminate it. I am sure there are timeouts to unused connections or locked connection. try stopping the oracle sql developer.
 
Sheriff
Posts: 21747
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's probably not a locked session, but more an active transaction. I've seen it happen too many times - I make changes in SQL Developer, forget to commit, and my application either hangs (for insert, update and delete statements) or gives stale results (for select statements). Just click on the commit button and you should see progress in your application.
 
Don't listen to Steve. Just read this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!