Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes JDBC Batch updates(Oracle jdbc api & jdbc2.0) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Batch updates(Oracle jdbc api & jdbc2.0) " Watch "JDBC Batch updates(Oracle jdbc api & jdbc2.0) " New topic
Author

JDBC Batch updates(Oracle jdbc api & jdbc2.0)

Nevin kumar
Ranch Hand

Joined: Mar 15, 2008
Posts: 93
I'm trying to do an update using Oracle JDBC api but it always returns me 0 irrespective whether a record is succesfully updated or not.I need to differentiate
between the successful update & unsuccessfull update.Basing on the result I need to perform some action
if(successfull){
ignore
}else{
insert
}
Is there any way I can differentiate whether a record is succesfully updated or not.



Later I tried with JDBC 2.0 for batch updates,the problem still persists this always returns -2 whether a record is succesfully updated or not

Request you to let me know if any of you have some kind solution for this,any help highly appreciated
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


Naveen,


Do you like to know how to produce a unsuccessfull update ? Create a unique constraint , or some NULL constraint and try to update the record , you would get unsuccessful udpate , for other case you should get positive integer.

getUpdateCount() would give you the results.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC Batch updates(Oracle jdbc api & jdbc2.0)
 
Similar Threads
batch update in SQL
Batch Update by passing Inparameters in JDBC Template
URLyBird: Concurrent modification of records - How to deal with it?
[NX URLyBird]: About deleted flag in URLyBird
Two questions on CallableStatement