• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

executeUpdate() always false

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

The following code is either inserting or not inserting records but always false. I am trying to display error when record not inserted


Thanks in anticipation
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13077
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where do you catch any SQLException that might be thrown and log / display it?

Bill
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I removed rs.close(); as this was un-necessary. Now its working perfectly

Thanks

 
J. Kevin Robbins
Bartender
Pie
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do need the close statements, but they should be in a finally block. What you have is going to leave open connections if it hits an error, and it won't even log an error to let you know something went wrong. It will just keep eating connection pool objects until the pool is depleted.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
J. Kevin Robbins wrote:You do need the close statements, but they should be in a finally block. What you have is going to leave open connections if it hits an error, and it won't even log an error to let you know something went wrong. It will just keep eating connection pool objects until the pool is depleted.


I really appreciate your advice. Thankful to you from the bottom of my heart
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic