• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Calling function in database from servlet

 
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am having multiple problems with my stored procedure func_ConvertDecimalHours. Could anyone have a look and tell me what I am doing wrong?

 
Bartender
Posts: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couple of things. Tell us more about what's happening when you run this code and what you expect. Give us the stack trace if you have one. But even without that I see a couple of issues. First, for a stored procedure you want to use a CallableStatement, not a PreparedStatement. And I don't see where you are executing the statement. Is this an update or are you expecting a ResultSet to be returned? It's hard to tell from the function name. I would expect your code to look something like this:

This is just a rough guess. I have no idea what kind of result your stored procedure is returning, but this should help you to the next step.

And please avoid using variables with one character. It's not worth the effort of deciphering the code especially several months from now.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!