Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[BUG] Statement execute thrown exception doesn't populate the odbcErrors array

未关闭
#429 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript
领域
database

调研方向

从 Statement.execute() 路径开始,使用 unixODBC 跟踪,针对 DB2 for i 通过提供的 prepare、bind 和 execute 序列重现该失败。将抛出的错误与执行期间可用的 ODBC 诊断信息进行比较;当错误的 odbcErrors 数组包含描述该语句失败的信息时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Describe your system

  • odbc Package Version: 2.4.9
  • ODBC Driver: 1.1.0.28-0
  • unixODBC 2.3.9
  • Database Name: DB2 for i
  • Database Version: V7R5M0
  • Database OS: IBM i
  • Node.js Version: 18.18.2
  • Node.js OS: IBM i

Describe the bug
The error doesn't contain the odbcErrors data. console.log of the error in a catch block will give you

[Error: [odbc] Error executing the statement] { odbcErrors: [] }

Expected behavior
odbcErrors to have the information about what caused the error

To Reproduce
Steps to reproduce the behavior:

  1. Run the node.js code below:

Code

try {
const connection = await odbc.connect(my_connection_string);
const statement = await connection.createStatement();
let bindVal = [
        field1 || '',
        field2 || '']
await statement.prepare(`UPDATE MYLIB.MYTABLE
      SET 
      FIELD1 = ?
      WHERE FIELD2 = ?`);
await statement.bind(bindVal);
const result = await statement.execute();
} catch (error) {
        console.log(error);
        const odbc_error = error?.odbcErrors || 'No ODBC error object';
        console.log(odbc_error)
        const odbc_error_message = error?.odbcErrors?.[0]?.message || 'No ODBC error message';
        console.log(odbc_error_message)
}

Additional context
Checked the following table to find out what the error was but couldn't find anything there either:
qsys2.history_log_info
qsys2.joblog_info
https://github.com/IBM/node-odbc/issues/389 - @harsh-savvient mentioned this issue
https://github.com/IBM/node-odbc/issues/363 - @mikemicmike also raised this issue Dec 21, 2023 and @FredoMartini confirmed it March 1, 2024 and the robot closed the issue May 30, 2024 as stale
https://github.com/IBM/node-odbc/issues/30

主要语言
JavaScript
星标
159
派生
92
平均合并
5 小时 59 分钟
30 天内合并 PR
3

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

IBM/node-odbc 的其他 Issue

查看 IBM/node-odbc 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。