This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to call procedure

 
Singh Anisha
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
calling servlet

method in java class


Here i am trying to call a procedure defined in mysql but ifcalled is returning with false..
if i am missing something..
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the PrepareStatement.execute() method in the javadoc (as CallableStatement inherits it from the PreparedStatement). The return value of false doesn't mean the call failed. Your stored procedure is successfully called. If it wasn't, an SQLException would be thrown.

Also, you've registered the output parameter as the third one. You therefore need to pass 3 to cstmt.getFloat(), not 1.
 
Singh Anisha
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then what the false mean...
 
Singh Anisha
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, I correct the mistake and its perfect now
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome. Glad you get it to work.

Singh Anisha wrote:Then what the false mean...

Well, look it up in the javadoc.

If you haven't used javadoc yet, you can click the PreparedStatement link here or above. It will lead you to an online version of javadoc, and you should be able to navigate to the execute() method fairly easily.

In any case, you should configure your environment to give you easy access to javadoc. A bookmark in the browser will do (in Chrome, there is a Javadoc Search Frame extension, which makes navigating it much easier; similar extensions may exist for other browsers), but better still is to configure your IDE (if you're using one) to look up classes and methods documentation directly from the source editor. You can ask in the IDE forum, if you have troubles configuring your IDE to allow this.

Javadoc is an indispensable tool for any Java developer, and a big strength of Java. I've worked with languages and IDEs that had much worse help systems.
 
Singh Anisha
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am familiar with javadoc and used it many times but was unaware about that i can configure it with my IDE.
Will follow your advise for sure.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic