Unanswered: .Net ODBC lost decimal separator from DB2
I am using DB2 v10, .Net 2.0 C#. I am connectiong to my DB2 with ODBC. The problem is that at SELECT statement decimal separator, in this case "." get lost. Column datatype in DB2 is DECIMAL(x,y). Culture on my PC and also on Server PC German. What i tryed till now is to change culture on both PCs, and I configured db2cli.ini adding PATCH2=15. Nothing works. Can someone please help? Also I use IBM DB2 ODBC DRIVER in DNS System, which configuration i was changing too, without success. Is there anything else I can try? I also tested my DB2 witd OLEDB and it works, i got back decimal number, but ODBC, if I have, for example 11.23 in DB2, in C# it give me 1123.
Can you check if the raw CLI shows the decimal separator? (that is, just for a test, eliminate the .net). Here is one way to do that test:
In a db2cwadmin.exe window, if you perform "db2 connect to your_database" and then
try a db2 "select your_decimal_column ..."
Does the decimal-point appear, or does it appear as a comma?
If you can see the separator (comma or decimal-point) then the problem lies in .net configuration I think.
If you set PATCH2=15 in db2cli.ini, remember to disconnect and reconnect all db2 connections from your workstation before you retry (just close and reopen db2cwadmin.bat).
If you set PATCH2=15, and the raw CLI (at the command-line ) shows the separator as the point then look at your .net configuration.
If the raw CLI is also dropping the decimal-point, look again at your db2cli.ini contents, and then try a cli trace to see if you can find clues.
Please verify that your *system-default-locale* on your Windows workstation is German, and that your (Windows 7) Control-Panel --> Region and Language --> Additional Settings --> Numbers --> Decimal Symbol : has a value either comma , or point .
This means that DB2 CLI is working correctly.
I believe that .net ODBC just uses CLI (it is a layer on top of CLI).
I believe that the configuration issue lies inside .Net and not with DB2 - in other words I beleive that DB2 is giving .net the data in the correct db2 format for CLI applications but for some configuration reason the .net is not reacting as you expect it to do.
You might want to research .Net forums/helpsites.
I am using .Net 2.0. I just tryed to get data from datatype REAL Column and it works! Decimal separator is there, also I tryed with Excel, with the same DSN as I use in .Net ODBC to create SQL Query to my DB2 and it works too! I get decimal numbers from DECIMAL(x,y) columns.