-1

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.

Hari
  • 37
  • 2
  • 8
  • You have to pass two more parameter, which can handle the output from procedure. https://docs.oracle.com/cd/E17952_01/connector-j-en/connector-j-usagenotes-statements-callable.html – Vivek Dec 11 '18 at 20:03
  • I got it resolved by changing this SqlParameterSource in = new MapSqlParameterSource().addValue("arg1", a).addValue("arg2",b); – Hari Dec 11 '18 at 20:10
  • @vivek Do you have any idea, if the input argument passing should match exactly in stored procedure ? – Hari Dec 11 '18 at 20:11

1 Answers1

0

I got it resolved by changing this :

SqlParameterSource in = new MapSqlParameterSource().addValue("arg1", a).addValue("arg2",b); 
Hari
  • 37
  • 2
  • 8