Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

DB2 does not specify Schema call stored procedure failed SQLCODE=-440, SQLSTATE=42884

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

■ phenomenon

The DB2,Schema does not match the user name that accesses the DB.

Schema must be specified when calling the stored procedure, otherwise Error.

■ error code

Stored procedure

SET SCHEMA = "QUOT"; SET CURRENT PATH = "SYSIBM", "SYSFUN", "SYSPROC", "SYSIBMADM", "DB2INST1"; CREATE PROCEDURE COPY_TABLES () BEGIN . END; GRANT EXECUTE ON PROCEDURE "QUOT". "COPY_TABLES" (INTEGER, TIMESTAMP, INTEGER, INTEGER) TO USER "DB2INST1" WITH GRANT OPTION

Mapper.xml

CALL COPY_TABLES (# {userId, jdbcType=INTEGER, mode=IN}, # {currentTime, jdbcType=TIMESTAMP, mode=IN}, # {reasonTypeFlag, jdbcType=INTEGER, mode=IN}, # {copyReason, jdbcType=INTEGER, mode=IN})

Mapper.java

/ * Copy Tables * * @ param param the parameter * / void copyTables (Map param)

Service.java

Map paramMap = new HashMap (); paramMap.put ("userId", userId); paramMap.put ("currentTime", currentTime); paramMap.put ("reasonTypeFlag", 1); paramMap.put ("copyReason", 1); Mapper.copyQuotationTables (paramMap)

Tomcat context.xml

■ correct code

Append currentFunctionPath to Tomcat context.xml.

If you want to call a stored procedure in a DB tool such as Toda, but do not specify Schema

Such as CALL COPY_TABLES (.)

You need to specify Current Path when you create a stored procedure

SET CURRENT PATH = "SYSIBM", "SYSFUN", "SYSPROC", "SYSIBMADM", "DB2INST1", "QUOT"

■ reason

DB2 stored procedures (and functions) are not controlled by CURRENT SCHEMA, but by CURRENT PATH.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report