aspose file tools*
The moose likes Other Application Frameworks and the fly likes Error while calling stored procedure with Spring Jdbc Dao (StoredProcedure) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Error while calling stored procedure with Spring Jdbc Dao (StoredProcedure)" Watch "Error while calling stored procedure with Spring Jdbc Dao (StoredProcedure)" New topic
Author

Error while calling stored procedure with Spring Jdbc Dao (StoredProcedure)

prveen dhannapuneni
Greenhorn

Joined: Oct 13, 2007
Posts: 7
I am using Spring StoredProcedure class to call sybase stored procedure. But i am getting below error.

Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call sts_config..FindScriptBySource(?, ?, ?, ?, ?)}]; SQL state [HY010]; error code [0]; Output parameters have not yet been processed. Call getMoreResults().; nested exception is java.sql.SQLException: Output parameters have not yet been processed. Call getMoreResults().
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:952)
at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:985)
at org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:117)
at com.spring.jdbcexample.StoredProcedureDao.executeFor(StoredProcedureDao.java:25)
at com.spring.jdbcexample.JDBCMain.main(JDBCMain.java:34)
Caused by: java.sql.SQLException: Output parameters have not yet been processed. Call getMoreResults().
at net.sourceforge.jtds.jdbc.ParamInfo.getOutValue(ParamInfo.java:159)


Here is my Code:

public class StoredProcedureDao extends StoredProcedure{
public StoredProcedureDao(JdbcTemplate template){
super(template, "sts_config..FindScriptBySource");
declareParameter(new SqlParameter("sourceCode", Types.VARCHAR));
declareParameter(new SqlOutParameter("sourceCd", Types.VARCHAR));
declareParameter(new SqlOutParameter("scriptCd", Types.VARCHAR));
declareParameter(new SqlOutParameter("exprDate", Types.DATE));
declareParameter(new SqlOutParameter("scriptText", Types.VARCHAR));
compile();
}
public String executeFor(String sourceCode){
Map input=new HashMap();
input.put("sourceCode", sourceCode);
Map output=execute(input);
StringBuffer obj=new StringBuffer();
obj.append((String)output.get("sourceCd"));
obj.append((String)output.get("scriptCd"));
obj.append((String)output.get("exprDate"));
obj.append((String)output.get("scriptText"));

return obj.toString();
}
}

Please any one help me, why i am getting this error?

Thanks
Pavan.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error while calling stored procedure with Spring Jdbc Dao (StoredProcedure)