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 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 Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC -ORACL nls problem.please help." Watch "JDBC -ORACL nls problem.please help." New topic
Author

JDBC -ORACL nls problem.please help.

dreamonb
Greenhorn

Joined: Jun 11, 2001
Posts: 2
Hi,
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,classes12.zip
i am disperate please help
thx
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"dreamonb",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . 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.
Thanks.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Bjarki Holm
Author
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:
<code>
ALTER SESSION SET NLS_LANGUAGE='ICELANDIC';
ALTER SESSION SET NLS_TERRITORY='ICELAND';
</code>
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:
<code>
export NLS_LANG=American_America.we8iso8859p1
</code>
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:
<code>
java -Duser.language=ICELANDIC ... [specify Java class]
</code>
More information on this topic is available at http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/ java.817/a83724/advanc1.htm#1001170.
Cheers,
Bjarki Holm
Author of Professional Java Data

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


Bjarki Holm
dreamonb
Greenhorn

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
with
mychar2=new String(rs.getBytes(1),"ISO-8859-7");
thx anyway for the tip
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC -ORACL nls problem.please help.