Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

callablestatement inserting record but returning false

 
michael tall
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am entering student information in an html/jsp form which is invoking the servlet. I find the records inserted into database. However, after executeUpdate(), control is going to catch block. When I tried placing execute()/executeUpdate() in if else block, , control is going to else block but the record is being inserted successfully. Why is the execute() not returning a successful value?
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes .. This is the actual behavior

Check the Spec.

http://java.sun.com/javame/reference/apis/jsr169/java/sql/CallableStatement.html
 
Casttro Francis
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Meetgaurav U R rite..

Michael,
Please read the API documentation and look for the execute method. That will explain it all to you.

http://java.sun.com/javase/6/docs/api/java/sql/CallableStatement.html :thumb:
 
michael tall
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After the statement is executed, it should naturally go to the very next statement. Instead it jumped even when there was no test condition.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic