Announcement Announcement Module
Collapse
No announcement yet.
Informix Problems Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Informix Problems

    Sorry I'm newbee with Spring anybodo Can you help me whit this problem?
    Thanks in advance
    Java Code:

    public class TestStoredProcedure {
    public static void main(String[] args) {
    TestStoredProcedure t = new TestStoredProcedure();
    t.test();
    System.out.println("Done!");
    }

    void test() {
    DriverManagerDataSource ds = new DriverManagerDataSource();
    ds.setDriverClassName("com.informix.jdbc.IfxDriver ");
    ds.setUrl("jdbc:informix-sqli://sbtandil:1526/quilmes:INFORMIXSERVER=sbtandil");
    ds.setUsername("informix");
    ds.setPassword("informix");
    MyStoredProcedure sproc = new MyStoredProcedure(ds);
    Map res = sproc.execute();
    printMap(res);
    }

    private class MyStoredProcedure extends StoredProcedure {
    public static final String SQL = "testiranje";

    public MyStoredProcedure(DataSource ds) {
    setDataSource(ds);
    setFunction(false);
    setSql(SQL);
    declareParameter(new SqlReturnResultSet("p_return", new RowMapper()
    {

    public Object mapRow(ResultSet arg0, int arg1) throws SQLException {
    Integer i = new Integer(999);

    Map map = new HashMap(10);

    i = new Integer(arg0.getInt(1));

    map.put("1",i);


    return map;
    }

    }));
    declareParameter(new SqlParameter("name", Types.VARCHAR));
    compile();
    }

    public Map execute() {
    Map params = new HashMap();
    params.put("name", "12336");
    Map out = execute(params);

    return out;
    }
    }

    private static void printMap(Map r) {
    Iterator i = r.entrySet().iterator();
    while (i.hasNext()) {
    System.out.println((String)i.next().toString());
    }
    }
    }

    Store Procedure:

    CREATE PROCEDURE testiranje
    (p_test VARCHAR(50))
    RETURNING VARCHAR(50);
    DEFINE p_return VARCHAR(50);
    LET p_return = p_test;
    RETURN p_return;
    END PROCEDURE;

    Error Exception:

    Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException : CallableStatementCallback; uncategorized SQLException for SQL [{call testiranje(?)}]; SQL state [IX000]; error code [-79782]; Method can be called only once.; nested exception is java.sql.SQLException: Method can be called only once.
    java.sql.SQLException: Method can be called only once.
    at com.informix.util.IfxErrMsg.getSQLException(IfxErr Msg.java:349)
    at com.informix.jdbc.IfxStatement.getUpdateCount(IfxS tatement.java:653)
    at org.springframework.jdbc.core.JdbcTemplate.extract ReturnedResultSets(JdbcTemplate.java:904)
    at org.springframework.jdbc.core.JdbcTemplate$5.doInC allableStatement(JdbcTemplate.java:867)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:824)
    at org.springframework.jdbc.core.JdbcTemplate.call(Jd bcTemplate.java:857)
    at org.springframework.jdbc.object.StoredProcedure.ex ecute(StoredProcedure.java:102)
    at sample.prueba.TestStoredProcedure$MyStoredProcedur e.execute(TestStoredProcedure.java:80)
    at sample.prueba.TestStoredProcedure.test(TestStoredP rocedure.java:45)
    at sample.prueba.TestStoredProcedure.main(TestStoredP rocedure.java:34)


    In addition i'm not get in my java code the params returning by the store procedure.

  • #2
    Informix Stored procedure

    Hi,
    I'm newbee with Spring too and i have the same problem!!

    Please... can anybody help me?

    Thanks!

    Comment


    • #3
      The problem was fixed.

      The problem was the informix's driver, we changed the driver and the problem was fixed..
      ;-) greetings.

      Comment


      • #4
        Please let me know what driver you upgraded to to get rid of the problem. We are using version 3.0 of the IBM JDBC Informix driver and still have this problem.

        Comment


        • #5
          Driver

          Hi SAHorowitz tell me a email address, and i send you the jar. If you want? No problem.

          Comment


          • #7
            Originally posted by fcolombo
            The problem was the informix's driver, we changed the driver and the problem was fixed..
            ;-) greetings.
            Thanks!!

            Regards,
            Sergio

            Comment

            Working...
            X