Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`ResultSet::getString()` throws `std::bad_alloc` with IBM Db2 CLI unless `getStringLength()` is called first.

Open
#56 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Tech stack
cpp
Domain
databases

Research direction

Start with the reported ResultSet::getString() and getStringLength() behavior using the IBM Db2 CLI/ODBC driver on Ubuntu 22.04 with clang++ 18 or g++ and C++23. The uploaded odbc-cpp-wrapper-db2luw-test.cpp was not available, so first reproduce the failure and compare retrieval with and without the preceding length call; done means string retrieval succeeds without that workaround.

Written by the indexing model from the issue text.

Description

Summary

ResultSet::getString() throws std::bad_alloc when retrieving a string column through the IBM Db2 CLI/ODBC driver from C++ programs compiled with clang or g++ with -std=c++23 flag.

Calling ResultSet::getStringLength() for the same column immediately before getString() makes the retrieval succeed.

The query itself works correctly through isql, so the Db2 datasource, authentication, SQL statement, and IBM CLI/ODBC driver are functional.

Environment

  • OS: Ubuntu 22.04
  • Compiler: clang++ 18
  • C++ standard: C++23
  • Driver manager: unixODBC
  • Database: IBM Db2 LUW
  • Db2 driver: IBM Data Server Driver for ODBC and CLI
  • Driver library: libdb2.so
  • Wrapper: odbc-cpp-wrapper
Dominant language
C++
Stars
53
Forks
30
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SAP/odbc-cpp-wrapper

All issues in SAP/odbc-cpp-wrapper

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.