Search code examples
javaoraclestored-proceduresjdbctemplatesimplejdbccall

SimpleJdbc, Invalid Conversion Requested


Using Oracle database This is my testMethod

public void testConnection(int a, int b) {
    this.jdbcTemplateObject = new JdbcTemplate(mysqlDataSource());
    SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplateObject).withCatalogName("packageName").withProcedureName("myProcedureName");

    SqlParameterSource in = new MapSqlParameterSource().addValue("arg1", a);
    SqlParameterSource in2 = new MapSqlParameterSource().addValue("arg2", b);
      Map<String, Object> out = jdbcCall.execute(in,in2);

Below is my procedure

PROCEDURE get_misc_shipment_type (a  IN  NUMBER,
                                  b  IN  NUMBER,
                                  c  OUT VARCHAR2,
                                  d  OUT VARCHAR2);  

My datasource connections are good and i verified database is being connected, but it throws this error,

callableStatementCallback; uncategorized SQLException for SQL [{call XX_RATELINX_SHIPPING_ENGINE.GET_MISC_SHIPMENT_TYPE(?, ?, ?, ?)}]; SQL state [99999]; error code [17132]; Invalid conversion requested; nested exception is java.sql.SQLException: Invalid conversion requested

I am not getting what am i doing wrong, any help is appreciated.


Solution

  • I got it resolved by changing this :

    SqlParameterSource in = new MapSqlParameterSource().addValue("arg1", a).addValue("arg2",b);