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.
I've seen a lot of JDBC Code samples and examples for doing batch updates using the plain Statement interface. But I want to do the batch updates using the PreparedStatement interface, and I don't want to use the addBatch(String sql) method that PreparedStatement inherits from the Statement interface. Rather I want to use the addBatch() method of the PreparedStatement that can re use the same statement along with various data values to form different statements of the batch. The problem is that I am a bit confused about the exact usage... Can anyone give me a small example? Is the method invoked after setting a new set of data values or before setting it for each new batch statement? Thanks in advance!