aspose file tools*
The moose likes JDBC and the fly likes callablestatement inserting record but returning false Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "callablestatement inserting record but returning false" Watch "callablestatement inserting record but returning false" New topic
Author

callablestatement inserting record but returning false

michael tall
Ranch Hand

Joined: Nov 02, 2008
Posts: 61

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

Joined: Oct 08, 2008
Posts: 492
Yes .. This is the actual behavior

Check the Spec.

http://java.sun.com/javame/reference/apis/jsr169/java/sql/CallableStatement.html
Casttro Francis
Greenhorn

Joined: Oct 08, 2008
Posts: 25
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:


Any fool can write code that a computer can understand. Good programmers write code that humans can understand....
michael tall
Ranch Hand

Joined: Nov 02, 2008
Posts: 61
After the statement is executed, it should naturally go to the very next statement. Instead it jumped even when there was no test condition.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: callablestatement inserting record but returning false