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

  • Array parameter in stored procedure

    I'm trying to call stored procedures, using the StoredProcedure class of the springframework. This works perfectly for most of our stored procedures.
    For one of them however, there is a IN parameter of type ARRAY (an array of Bigints), which i registered as java.sql.types.ARRAY. I can't manage to get this working, and always the following error occurs (or alike): "invalid data conversion: Parameter instance [...] is invalid for the requested conversion". I tried passing collections, arrays, strings, ...
    Additionaly, when I try to execute following snippet, i get a badgrammar exception.
    Code:
    jdbcTemplate.execute("call clsm.save_grouping(1,ARRAY[1],ARRAY[1])");
    even when this command works using the db2 command line.
    Has anyone already managed to achieve this scenario? Thanks a lot for any suggestions.

    Environment: Websphere (was), db2 9.5, driver com.ibm.db2.jcc.DB2Driver (3.51.90), spring 2.5.5

  • #2
    Apparently, a java.sql.Array object should be set for Array parameters. However since no implementation is foreseen to do the conversion from a list (or array) to such type, I have to use the DB2Connection class to do this (which makes the code db2 dependent)

    Comment

    Working...
    X