File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Oracle JDBC driver problem on Canada locale Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Oracle JDBC driver problem on Canada locale" Watch "Oracle JDBC driver problem on Canada locale" New topic
Author

Oracle JDBC driver problem on Canada locale

David Chen
Ranch Hand

Joined: Jan 06, 2002
Posts: 57
Hi, there:

I have problem on Oracle JDBC thin driver with Canada locale on client side:
I'm using Oracle9i thin jdbc driver, the nls parameters in oracle database is:
NLS_LANGUAGE: AMERICAN
NLS_TERRITORY: AMERICA
NLS_NUMERIC_CHARACTERS : .,

My java client side is running on Windows NT, which using jdbc thin driver to connect oracle database. If I set the locale in client side as "English(Canada)", it seems return me "French" number format, like ",45" (comma, instead of decimal point) for "0.45". However, If I set client side locale as "English(United States)", it returns me "0.45" as expected.
So, my question: does Oracle JDBC driver always returns "French" number format evenif I set "English(Canada)" as locale? Because Canada have both English and French locale "French(Canada), and English(Canada)". How can I get "English" number format like "0.45" with "English(Canada)" locale setting?

Really appreciated any reply, and thanks a lot in advance

David
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30368
    
150

"DavidChen",
We're pleased to have you here with us in the JDBC forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

Your name is really close. Just missing a space.

Thanks,
Jeanne
Forum Bartender


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

Yes there is support for NLS....
download the nls_charset12.zip from oracle and read some iplementaion of It.
here is the link

http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
David Chen
Ranch Hand

Joined: Jan 06, 2002
Posts: 57
Thank you very much Shailesh, I added nls_charset12.zip with classes12.zip, however, I got the same problem.
In client side, if I set locale as en_US, the value of NLS_NUMERIC_CHARACTERS is ".," which is right, however if I set locale as en_CA, the value of NLS_NUMERIC_CHARACTERS is ", " which is not right.
Also, if I get the result by string (getString() ), and using NumberFormat to parse the String ( ex ",45"), it will raise the exception if I set locale as en_CA for NumberFormat, but works fine if I set locale as Canada_French for NumberFormat. So, I just guess, it's a bug in oracle jdbc driver, which returns French number format for en_CA locale.
Thanks in advance if anyone have any idea on this problem

Thanks a lot
David
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Oracle JDBC driver problem on Canada locale