Problem with decimal separator using IBM's DB2.NET data provider

  • Thread starter =?iso-8859-1?q?Lars_Bj=F8nnes?=
  • Start date
?

=?iso-8859-1?q?Lars_Bj=F8nnes?=

Hi,

we're developing a web application using IBM's DB2.NET data provider
for connecting to a DB2 server, and have run into a problem regarding
decimal separators and internationalisation/localisation.

..NET SDK 1.1
DB2.NET Data Provider v8.1.2.1
DB2 8.1 SP4A
Windows 2003 Server



If the user's

System.Thread.Threading.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator

(*phew* :)

is set set to "," (comma), we get an "Incorrect number format
exception" when doing a SELECT on a table containing a field/column of
the decimal datatype.

If we set the current thread's NumberDecimalSeparator to "." (dot),
and then execute the SELECT statemenent, all goes well. (No
exceptions.)

It seems like the DB2.NET provider expects the decimal separator used
by the DB2 server to match the user's NumberDecimalSeparator. Is this
true?

This is a major issue for us, as we must support users with different
Culture-settings. Is there a way to to tell the DB2.NET provider which
decimal separator the DB2 server is using? Other workarounds?
 
V

Val Mazur

Hi Lars,

Do you pass any parameters to your SELECT or concatenate anything to the
query?
 
?

=?iso-8859-1?q?Lars_Bj=F8nnes?=

Val Mazur said:
Hi Lars,

Do you pass any parameters to your SELECT or concatenate anything to the
query?

No parameters or concatenation. I suspect it is a DB2.NET-provider
problem, since we've had no such problems using the OLEDB-provider.


Example:

SELECT myintegerfield FROM mytable

executes with no problem.

If we do:

SELECT mydecimalfield FROM mytable


we get the "Incorrect number format exception".
 
V

Val Mazur

Hi,

Yes, looks like a provider's issue. Try to check with the vendor of the
provider. I think it should be something known, since it is very simple to
reproduce.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top