Skip to content
Ryan Culpepper edited this page Mar 18, 2018 · 11 revisions

ODBC DB2 Notes

Setup

The following links were useful in setting up a DB2 instance for testing:

Issue: decimal/numeric results don't work

This page suggests that DB2 does not support SQLSetDescField, which means that the set-numeric-descriptors method (which sets the precision, etc) won't work.

In fact, when I check the result of (SQLSetDescField/Int hdesc i SQL_DESC_TYPE SQL_C_NUMERIC), I get -1 (SQL_ERROR), but no diagnostic.

These docs indicate that the current code is using the wrong convention for calling SQLSetDescField with an integer value, but after fixing that issue the function still returned -1 without diagnostic.

But then these docs seem to contradict that theory.

I also tried changing the numeric/decimal case to use SQL_C_NUMERIC directly rather than SQL_ARD_TYPE, but it still failed (but with a different message).

Other references:

Clone this wiki locally