Announcement Announcement Module
No announcement yet.
Stored Procedure throwing error: Method can be called only once Informix Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stored Procedure throwing error: Method can be called only once Informix

    On running a stored procedure after extending the spring storedprocedure class I am getting the error shown below. The same procedure works fine if I call preparedstatement and hardcode the function.

    This is the code that I am using.
    *******NOT WORKING ***********************

    public class ProcessTransStoredProc extends StoredProcedure {

    private static final Logger logger = Logger.getLogger(ProcessTransStoredProc.class);

    private static final String STORED_PROC_NAME = "DSPCHG9900";
    private static final String CASE_ID = "p_case_id";
    public ProcessTransStoredProc(DataSource ds) {
    super(ds, STORED_PROC_NAME);

    Map<String, Integer> inParams = new HashMap<String, Integer>(1);

    public void execute(int idCase){
    declareParameter(new SqlParameter(CASE_ID, Types.INTEGER));
    inParams.put(CASE_ID, idCase);


    ***** PREVIOUSLY WORKING *********************

    private boolean runProc(int id, String procName) {

    Session session = sessionFactory.getCurrentSession();
    try {
    PreparedStatement st = session.connection().prepareStatement("{call " + procName + " (?);}");
    st.setString(1, new Integer(id).toString());
    //st.setString(2, "DSPCHG");
    return st.execute();
    } catch(SQLException sqle) {
    throw new DCSSRuntimeException(sqle.getMessage(), sqle.getCause());

    public boolean dispchg9900(int id){
    return runProc(id, "DSPCHG9900");

    Stack trace:

    dars.dcss.service.exceptions.DCSSRuntimeException: CallableStatementCallback; uncategorized SQLException for SQL [{call DSPCHG9900(?)}]; SQL state [IX000]; error code [-79782]; Method can be called only once.; nested exception is java.sql.SQLException: Method can be called only once.
    at com.informix.util.IfxErrMsg.getSQLException(IfxErr
    at com.informix.jdbc.IfxStatement.getUpdateCount(IfxS
    at org.apache.commons.dbcp.DelegatingStatement.getUpd ateCount(
    at org.springframework.jdbc.core.JdbcTemplate.extract ReturnedResultSets(
    at org.springframework.jdbc.core.JdbcTemplate$5.doInC allableStatement(
    at org.springframework.jdbc.core.JdbcTemplate.execute (
    at org.springframework.jdbc.object.StoredProcedure.ex ecute(
    at dars.dcss.domain.common.ProcessTransStoredProc.exe cute(
    at dars.dcss.domain.common.ProcessTransDaoImpl.dispch g9900(
    at est.dspchg9900(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.internal.runners.TestMethodRunner.execut eMethodBody(
    at org.junit.internal.runners.TestMethodRunner.runUnp rotected(
    at nProtected(
    at org.junit.internal.runners.TestMethodRunner.runMet hod(
    at org.junit.internal.runners.TestClassMethodsRunner. invokeTestMethod(
    at org.junit.internal.runners.TestClassMethodsRunner. run(
    at org.junit.internal.runners.TestClassRunner$1.runUn protected(
    at nProtected(
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR
    at org.eclipse.jdt.internal.junit.runner.TestExecutio
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(
    Caused by: java.sql.SQLException: Method can be called only once.
    ... 31 more

  • #2
    informix bug


    the error below was due to a spring-informix issue. I tried the same thing with mySql d/b and it worked perfectly fine.