• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

getting problem while inserting data into database by using executebatch  RSS feed

Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iam using beans here
iam storing the data in arrayList object and iterating it.


pstmt = myConnection.prepareStatement("insert into xxxx values(?,?,?,?)");
pstmt.setString(1, xlformdataget.getEmail());

pstmt.addBatch(); ///adding to batch

int[] updateCounts = pstmt.executeBatch();

public static void processUpdateCounts(int[] updateCounts) {
for (int i=0; i<updateCounts.length; i++) {
if (updateCounts[i] >= 0)
s.o.p("Successfully executed; the number represents number of affected rows");
} else if (updateCounts[i] == Statement.SUCCESS_NO_INFO) {
s.o.p("Successfully executed; number of affected rows not available");
} else if (updateCounts[i] == Statement.EXECUTE_FAILED) {
s.o.p("Failed to execute");
} } }
author & internet detective
Posts: 39283
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see the error in your post. What's wrong?
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!