aspose file tools*
The moose likes Spring and the fly likes stored procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "stored procedure" Watch "stored procedure" New topic
Author

stored procedure

Ganeshkumar cheekati
Ranch Hand

Joined: Oct 13, 2008
Posts: 362
Hi friends,

can anyone help me on these, i am trying to calling a stored procedure, it should be the resultset in the form of Map object. For these i used spring jdbc concept but i am getting a error like BadSqlGrammerException.

dao classes method.

public Map getClassificationView(String sUser,String sLocation,String sPattern, String sCurrPage){
LOG.info(">>>>>>>>>>>METHOD NAME getClassificationView Starts in Classification DAO>>>>>>>>>>>>>");
ProcedureAndFunctions stproc = new ProcedureAndFunctions();
stproc.setJdbcTemplate(getJdbcTemplate());
stproc.setSql("DF_Get_classification_view");

stproc.declareParameter(new SqlOutParameter(sLocation,Types.VARCHAR));
stproc.declareParameter(new SqlOutParameter("null", Types.VARCHAR));
stproc.declareParameter(new SqlOutParameter(sCurrPage, Types.INTEGER));
stproc.declareParameter(new SqlOutParameter("Y", Types.VARCHAR));
stproc.compile();
Map results = stproc.execute();
for (Iterator it = results.keySet().iterator(); it.hasNext();)
{
System.out.println(results.get(it.next()));
}

LOG.info(">>>>>>>>>>>METHOD NAME getClassificationView Ends in Classification DAO>>>>>>>>>>>>>");
return results;
}

ProcedureAndFunctions.java:

public class ProcedureAndFunctions extends StoredProcedure
{
public ProcedureAndFunctions()
{
}

public Map execute()
{

Map inputs = new HashMap<String,Object>();
return super.execute(inputs);



}


}

and my stored procedure contain four IN parameters, can help me any on these, tell me this is better one for converting the resultset into Map object or any other alternative in spring.




SCJP5 and SCWCD1.5
Think Twice Act Wise...
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1680
    
    7

Please edit your post and UseCodeTags.

I did not look to closely at your code (formatting it with code tags would help) but the best reference in this case is the reference documentation they have pretty good example code there.

See the following:
http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/jdbc.html#jdbc-simple-jdbc-call-1
http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/jdbc.html#jdbc-simple-jdbc-call-3
http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/jdbc.html#jdbc-StoredProcedure
http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/jdbc.html#jdbc-complex-types


[How To Ask Questions][Read before you PM me]
Julia Young
Greenhorn

Joined: Jul 23, 2010
Posts: 1
Crossposted here http://forums.devshed.com/java-help-9/stored-procedure-in-spring-jdbc-926307.html#post2810447
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: stored procedure