Here we go... Java Env:WSAD 5.0 Local OS:Windows 2000 Pro DB:Oracle 9i (220.127.116.11) DB OS:Solaris 8.0(I think)
I am using a PreparedStatement.addBatch(), to do multiple database updates. In my first attempt I tried to use Replacable Parameters to set my values into the statement. This worked with 1 or more records, however, the int array that PreparedStatement.executeBatch() return contains nothing but -2's. Now, I know that -2 means "Successful, but updated number of records is unknown". But it would be nice to make sure the number of updated are what I think they should be. After seeing all of the -2's returned I modified my method to "build" the sql statements by using a StringBuffer. I then used Statement.addBatch(sqlString). This time the array returned all 1's which is what I wanted. My question is, does anyone know why PreparedStatement.executeBatch() returns -2's and Statement.executeBatch returns 1's while running the same queries? Here is a snippet of my code the large block of commented out code is from my second attempt. I am including it for posterity. At the bottom recordCount is an int.
Thanks in advance. [ May 22, 2003: Message edited by: Heath Lilley ]