Skip to content

[BUG] Unable to Call Stored Procedure with CLOB Parameters #137

Description

@DavidRusso

Describe your system

  • odbc Package Version: 2.3.5
  • ODBC Driver: IBM i Access ODBC Driver
  • Database Name: Db2 for i
  • Database Version: 7.2
  • Database OS: IBM i 7.2
  • Node.js Version: 12.18.4
  • Node.js OS: IBM i

Describe the bug
Calling a stored procedure with CLOB parameters doesn't work. When called using connection.query() the call succeeds, but the output parameter data is not returned. When called using connection.callProcedure() the call fails with an error:

[Error: [odbc] Error retrieving the result set containing information about the columns in the procedure] {
  odbcErrors: [
    {
      state: '',
      code: 30160,
      message: '[IBM][System i Access ODBC Driver]Column 15: Numeric value out of range.'
    },
    {
      state: '',
      code: 30160,
      message: '[IBM][System i Access ODBC Driver]Column 15: Numeric value out of range.'
    }
  ]
}

Expected behavior
CLOB parameters should work the same as any other.

To Reproduce
To reproduce, create a simple stored procedure with CLOB parameters, like this:

create procedure yourlib/testclob (
  in a clob(128K),
  out b clob(128K)
)
language sql
set b = a

Then try calling, like this:

const odbc = require("odbc");

(async () => {
  
  try {

    const connection = await odbc.connect(`Driver=IBM i Access ODBC Driver;System=localhost;uid=YOU;password=YOURS`);
    let result = await connection.query("call yourlib.testclob(?, ?)", ["Hello, world", ""]);
    console.log(result);
    result = await connection.callProcedure(null, "YOURLIB", "TESTCLOB", ["Hello, world", ""]);
    console.log(result);
    await connection.close();
    
  }
  catch (error) {

    console.error(error);
    process.exit(1);
    
  }
  
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions