JDBC Inserting commas instead of decimals
843854May 30 2003 — edited Jun 2 2003I am executing the following query THRU A JAVA APPLICATION:
INSERT INTO exception_detail
(
exception_detail_id,
exception_id,
meta_exception_id,
name,
value,
is_identifier,
date_deleted,
row_num
)
VALUES
(
exception_detail_s.nextval,
null,
null,
null,
(SELECT rate_value.rate_value FROM rate_value WHERE rate_value_id = 13210),
null,
null,
null
);
The select statement in the values clause selects a values such as 22.1545. When this program finishes executing the query and the insert is done, the database shows the value as 22,1545. I figured out that the comma in the value (22,1545)is showing up because my regional setting on my machine (Control Panel --> Regional Settings) is set to English(Canada).
Now I have tried to set the default locale to English(US), by using the following code.
Locale localeUnitedStates = Locale.US;
Locale.setDefault(localeUnitedStates);
When I do this the same program now enters a decimal in place of the comma, which is what I want. Your program Locale setting overwrites the one in the Control Panel --> Regional Settings.
Now that the issue is explained, I would like to know from anyone of you as to what exactly is causing this. Is the JDBC driver picking up on the locale setting and therefore doing some formatting to the string value "22.1545" when it is sent to the database. I am really just looking for a detailed explanation as to what is going on. I've tried to search these forums and google and haven't really found anything.
Help would be appreciated.
thanks.