This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Here we go... Java Env:WSAD 5.0 Local OS:Windows 2000 Pro DB:Oracle 9i (126.96.36.199) 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 ]