pentaho/pentaho-kettle · error · KettleDatabaseException

Unable to call procedure

Error message

Unable to call procedure

What it means

Thrown when executing a stored procedure via a CallableStatement fails at any stage — preparing, binding parameters, executing, or reading results/out-parameters. Kettle wraps the exception as "Unable to call procedure" in a KettleDatabaseException.

Solutions

  1. Match the call string exactly to the procedure signature: correct schema/package name, parameter order, count, and types; declare out-params with proper JDBC types.
  2. Grant EXECUTE privilege on the procedure to the DB user.
  3. Run the procedure call manually (SQL client) to see the database's native error, then fix that underlying SQL issue.
  4. Read the chained exception (getCause) for the exact SQLException from the driver.

Example fix

// before
db.callProcedure(callable, "MYPROC", "?", "?", "?", 3, "IIO"); // wrong order/types

// after
// signature: myproc(p_id IN NUMBER, p_name OUT VARCHAR2) RETURN NUMBER
db.callProcedure(callable, "SCHEMA.MYPROC", "? = call ?(?, ?)", "000", "NIO", 3, "NIO");
Defensive patterns

Strategy: try-catch

Validate before calling

// verify before calling:
// 1) user has EXECUTE on the procedure
// 2) parameter count/order/types match the signature
// 3) out-param JDBC types are declared correctly
DatabaseMetaData md = db.getDatabaseMetaData();
try (ResultSet rs = md.getProcedures(null, schema, procName)) {
  if (!rs.next()) throw new IllegalStateException("Procedure not found: " + procName);
}

Try / catch

try {
  ret = db.callProcedure(...);
} catch (KettleDatabaseException e) {
  throw new RuntimeException("Procedure call failed: " + e.getCause(), e);
}

Prevention

When it happens

Trigger: Database.callProcedure(...) with wrong parameter count/types vs the procedure signature, invalid procedure name or missing EXECUTE grant, wrong in/out parameter declaration, or the procedure raising an internal SQL error.

Common situations: Calling a procedure with parameters in wrong order; missing EXECUTE privilege on the procedure; procedure name not qualified with schema/package; procedure itself throws ORA-/SQL exceptions; using a driver that mishandles CallableStatement out-params.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/c939f58be9c83052. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/Database.java:4939

          } else {
            // Save the update count if it is available (> -1)
            updateCount = cstmt.getUpdateCount();
          }

          moreResults = cstmt.getMoreResults();

        } finally {
          if ( rs != null ) {
            rs.close();
            rs = null;
          }
        }
      } while ( moreResults || ( updateCount > -1 ) );

      return ret;
    } catch ( Exception ex ) {
      throw new KettleDatabaseException( "Unable to call procedure", ex );
    }
  }

  public void closeProcedureStatement() throws KettleDatabaseException {
    // CHE: close the callable statement involved in the stored
    // procedure call!
    try {
      if ( cstmt != null ) {
        cstmt.close();
        cstmt = null;
      }
    } catch ( SQLException ex ) {
      throw new KettleDatabaseException( BaseMessages.getString(
        PKG, "Database.Exception.ErrorClosingCallableStatement" ), ex );
    }
  }

  /**

View on GitHub (pinned to f3058517a1)