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
Summary
ResultSet::getString()throwsstd::bad_allocwhen retrieving a string column through the IBM Db2 CLI/ODBC driver from C++ programs compiled withclangorg++with-std=c++23flag.Calling
ResultSet::getStringLength()for the same column immediately beforegetString()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
libdb2.soodbc-cpp-wrapper