Help coderanch get a
new server
by contributing to the fundraiser
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

stored procedure

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.



 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Crossposted here http://forums.devshed.com/java-help-9/stored-procedure-in-spring-jdbc-926307.html#post2810447
 
Arch enemy? I mean, I don't like you, but I don't think you qualify as "arch enemy". Here, try this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic