首页 > 解决方案 > 使用 ODBC 在 ACE 11 ESQL 中访问 DB2 数据库

问题描述

我需要在 ESQL、App Connect Enterprise v11 中访问 DB2 数据库。我的腿上安装了一个DB2,可以查询数据。我在 Windows 中添加了一个 ODBC 数据源,并且测试连接成功。在 ace 控制台中,我将 ODBC 资源设置为

mqsisetdbparms ACENODE2 -n odbc::books -u db2root -p nable@123

我的集成节点在哪里ACENODE2,书籍是我的数据库。我唯一的困惑是我应该在计算节点数据源选项卡中给出模式或数据库名称,我都尝试过但都失败了。

我的 ESQL 代码是

SET OutputRoot.JSON.Data.books[] = SELECT P.BOOK_ID, P.TITLE, P.TOTAL_PAGES, P.ISBN FROM Database.books.books AS P;

其中书籍数据库有一个书籍表。我得到的警告是

Unresolvable database table reference "Database.books.books".

有了警告,我部署了项目,(这是一个从数据库中获取数据的简单 REST API)我得到以下错误作为响应。这里 getAllBooks 是我的消息流。非常感谢任何指导。

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>500 Internal Server Error</title>
</head>
<body>
    <h1>500 Internal Server Error</h1>
    <p>
        BIP2230E: Error detected whilst processing a message in node 'gen.TestBase.getAllBooks
        (Implementation).Compute'. <br>
BIP2348E: Error detected while attempting to obtain a connection to data source 'db2root' of type 'ODBC' using userid ''.
        <br>
BIP2393E: Database error: ODBC return code '-1' from data source 'DB2ROOT' using ODBC driver manager 'odbc32.dll'.
        <br>
BIP2322E: Database error: SQL State 'IM002'; Native Error Code '0'; Error Text '[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified'.
</p>
        <hr>
</body>
</html>

标签: db2odbcibm-integration-bus

解决方案


推荐阅读