Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Closing batch update causes NullPointer.  RSS feed

Heath Lilley
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I have a method that does a batch update to a database. I use a preparedStatement with bind variables to build the batch update. I can prepare the sql statement set the bind variables for every loop iteration. The executeBatch statement works fine. But in my finally, when I try to close the preparedStatement I get a nullPointerException. By inspecting the variables at runtime I can confirm that the preparedStatement is NOT null. Something in the .close method is causing this.
Here is an example of what I am doing...

I have run similar examples that only update 1 record without the batch statement calls and everything works fine.
Does anyone know of a bug with batch updates? Or am I doing something wrong.

My env is:
IDE: Websphere WSAD 5.0
AppServer: Websphere Advanced Edtion 4.0
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!