aspose file tools*
The moose likes Other Application Frameworks and the fly likes Call stored procedure with Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Call stored procedure with Spring" Watch "Call stored procedure with Spring" New topic
Author

Call stored procedure with Spring

Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 671
I have a stored procedure with 1 parameter (INOUT DECIMAL).
My class extends Spring framework StoredProcedure class. It errors at line:

Map outParams = execute(inParams);

java.sql.SQLException: The number of parameter values set or registered does not match the number of parameters.

The code is as follows:



BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 671
Found out it must be:

declareParameter(new SqlOutParameter("P1", Types.DECIMAL));

instead of:

declareParameter(new SqlParameter("P1", Types.DECIMAL));
Darvesh Niz
Ranch Hand

Joined: May 12, 2008
Posts: 119
(Blatant advertisin not allowed in this forum, and please don't resurrect months old threads. - Mark Spritzler)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Call stored procedure with Spring