File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JDBC -ORACL nls problem.please help. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC -ORACL nls problem.please help." Watch "JDBC -ORACL nls problem.please help." New topic

JDBC -ORACL nls problem.please help.


Joined: Jun 11, 2001
Posts: 2
I have folloing problem:
i get a string form keybord into a language( not english) greek,arabic etc but when i insert it into a Oracle Database
and i want to see what i have inserted i only got supid chars.
I used nls_charset12,zip,
i am disperate please help
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Bjarki Holm
Ranch Hand

Joined: May 25, 2001
Posts: 65
You must also make sure that the value of NLS_LANG is correctly set for the database scheme you are using. Manually, such as when using SQL*Plus, this can be set per session, by executing:
or whatever region/language you want to use.
For a JDBC application using the OCI driver, setting the environment variable NLS_LANG before the application is started should be enough. For example, on UNIX:
export NLS_LANG=American_America.we8iso8859p1
When using the JDBC Thin driver, another approach is necessary. The Thin driver obtains language and territory settings (<code>NLS_LANGUAGE and NLS_TERRITORY</code>) from the Java locale in the JVM <code>user.language property</code>. This can be set by supplying a parameter when the Java program/application server is started:
java -Duser.language=ICELANDIC ... [specify Java class]
More information on this topic is available at java.817/a83724/advanc1.htm#1001170.
Bjarki Holm
Author of Professional Java Data

[This message has been edited by Bjarki Holm (edited June 12, 2001).]

Bjarki Holm

Joined: Jun 11, 2001
Posts: 2
I solved the problem other way :
Before i sent data to JDBC i used a conversion from Greek to
iso i used ..
String sum=new String(bla.getBytes(),"ISO-8859-1");
and when i retrieved from database i converted it again in greek
mychar2=new String(rs.getBytes(1),"ISO-8859-7");
thx anyway for the tip
I agree. Here's the link:
subject: JDBC -ORACL nls problem.please help.
It's not a secret anymore!