Announcement Announcement Module
Collapse
No announcement yet.
Exception while calling stored procedure in sybase Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception while calling stored procedure in sybase

    I am trying to call a stored procedure of Sybase whihc returns a result set . But i get the following exception

    org.springframework.jdbc.UncategorizedSQLException : (executing CallableStatementCallback [CallableStatementCreatorFactory.CallableStatementC reatorImpl: sql=[{call iris_p2.dbo.test_for_sp()}]: params=[{}]]): encountered SQLException [Stored procedure 'iris_p2.dbo.test_for_sp' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
    ]; nested exception is com.sybase.jdbc2.jdbc.SybSQLException: Stored procedure 'iris_p2.dbo.test_for_sp' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
    at org.springframework.jdbc.support.SQLStateSQLExcept ionTranslator.translate(SQLStateSQLExceptionTransl ator.java:88)
    at org.springframework.jdbc.support.SQLErrorCodeSQLEx ceptionTranslator.translate(SQLErrorCodeSQLExcepti onTranslator.java:163)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:506)
    at org.springframework.jdbc.core.JdbcTemplate.call(Jd bcTemplate.java:520)
    at org.springframework.jdbc.object.StoredProcedure.ex ecute(StoredProcedure.java:101)
    at src.SimpleProc$DemoStoredProcedure.execute(SimpleP roc.java:97)
    at src.SimpleProc.execute(SimpleProc.java:67)
    at src.SimpleProc.main(SimpleProc.java:35)
    Exception in thread "main"

    SP:

    CREATE PROCEDURE test_for_sp
    AS
    SELECT address_id, postcode
    FROM address

    PROGRAM

    DemoStoredProcedure proc = new DemoStoredProcedure(ds);
    Map prc_val = proc.execute();
    printMap(prc_val);


    private class DemoStoredProcedure extends StoredProcedure {
    public static final String SQL = "p2.dbo.test_for_sp";
    private int count = 0;
    public DemoStoredProcedure(DataSource ds) {
    System.out.println("inside demo class----");
    setDataSource(ds);
    setSql(SQL);
    declareParameter(
    new SqlReturnResultSet("rs", new RowCallbackHandlerImpl()));
    compile();
    System.out.println("----COMPILED----");
    }
    public int getCount() {
    return count;
    }
    private class RowCallbackHandlerImpl implements RowCallbackHandler {
    public void processRow(ResultSet rs) throws SQLException {
    count++;
    }
    }
    public Map execute() {
    System.out.println("INSIDE execute");
    HashMap input = new HashMap();
    Map out = execute(input);
    System.out.println("MAP VALUE----" + out.size());
    return out;
    }
    }
    private static void printMap(Map r) {
    System.out.println("INSIDE PRINT MAP---" + r.size());
    Iterator i = r.entrySet().iterator();
    while (i.hasNext()) {
    System.out.println((String) i.next().toString());
    }
    }

  • #2
    Benno,

    Looks like a non Spring related JDBC issue. Can you get it to work with plain JDBC (without involving Spring)? If you can post the JDBC code, I can help you move that code to Spring's stored procedure support.

    Comment

    Working...
    X