Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting batchupdate exception while inserting recored for second time...

 
Ganeshkumar cheekati
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is code i wrote ..to connect to database and also getting filename,filedate and filesize from one folder but if i am trying to insert same records again then i am getting the error as

Statements that produce resultsets are not allowed in batch comments...





can anyone help me?
 
Michael Angstadt
Ranch Hand
Posts: 277
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the stored procedure do? It looks like it's trying to return data via a SELECT statement, and that JDBC has a problem with that.

Also, you should use foreach loops. For example:

And you should move the SimpleDateFormat object outside of the for loop because otherwise, you're creating it over and over again. Ditto for the setAutoCommit(false) line.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic