This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes prepared statement in batch always returning an array of -2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "prepared statement in batch always returning an array of -2" Watch "prepared statement in batch always returning an array of -2" New topic
Author

prepared statement in batch always returning an array of -2

G Ranjith
Greenhorn

Joined: Nov 29, 2005
Posts: 4
Hi,

Im using prepared statement. The statement is prepared outside the loop.
Inside the loop, datas are varied and added to batch.
On executing the batch , it returns an integer array.
The problem is , the values in the array are always -2 independent of whether the status is true or false.
Im always getting an array of -2(array length is equal to loop) even though sometimes database is upadated and sometimes not updated.

Any help in this regard is welcome.

Thanks in advance...
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
What you get depends on which database driver you're using. I'm guessing you're using the Oracle driver, 'cause that's what yo get from it:
http://www.stanford.edu/dept/itss/docs/oracle/9i/java.920/a96654/oraperf.htm#1057093
 
 
subject: prepared statement in batch always returning an array of -2
 
It's not a secret anymore!