Home » Developer & Programmer » JDeveloper, Java & XML » JDBC connection charset
JDBC connection charset [message #91064] Mon, 18 March 2002 02:15 Go to next message
Mohamed Itani
Messages: 2
Registered: March 2002
Junior Member
Hi,

I'm using classes12.zip (for oracle 8.1.7) JDBC thin driver and I'm connected to an oracle 8.1.7 hungarian database.

I use tomcat4 as my servlet container under win2000.

The problem is that I'm getting question marks or weird characters instead of the hungarian characters??
The character set of the database nls_lang is set to Hungarian.

How do I set the character set of my JDBC connection??

Thanks in advance
Itani
Re: JDBC connection charset [message #91141 is a reply to message #91064] Thu, 02 May 2002 12:59 Go to previous messageGo to next message
John D. Stein
Messages: 1
Registered: May 2002
Junior Member
From everything I am reading, the thin JDBC driver is supposed to automatically convert between the database character set (whatever it might be) and Java String. You should not have to do anything. See notes below.

However, I am finding that it doesn't always work. I get "character set incompatability" errors with the classes111b driver (Oracle 8.1.5)

http://otn.oracle.com/products/oracle8i/htdocs/faq_combined1.html#jdbc3

How does the setting of NLS_LANG affect the JDBC Thin Driver?
The JDBC Thin driver does not depend on NLS_LANG. Data retrieved from or inserted into the database via the Thin driver are directly converted from the database character set to Java string and vice versa.

http://oracle.cs.uoi.gr/enterprise_server/java.815/a64685/advanc1.htm#1003420

How JDBC Drivers Perform NLS Conversions
The techniques that Oracle's drivers use to perform character set conversion for Java applications depend on the character set the database uses. The simplest case is where the database uses the US7ASCII or WE8ISO8859P1 character set. In this case, the driver converts the data directly from the database character set to UCS-2 which is used in Java applications.

If you are working with databases that employ a non-US7ASCII or non-WE8ISO8859P1 character set (for example, Japanese or Korean), then the driver converts the data, first to UTF-8, then to UCS-2. For example, the driver always converts CHAR and VARCHAR2 data in a non-US7ASCII, non-WE8ISO8859P1 character set. It does not convert RAW data.

--------------------------------------------------------------------------------
Note:
The JDBC drivers perform all character set conversions transparently. No user intervention is necessary for the conversions to occur.
JDBC connection charset [message #91446 is a reply to message #91064] Tue, 10 September 2002 06:13 Go to previous message
L Rangarajan
Messages: 1
Registered: September 2002
Junior Member
When i try to retrieve a japanese character set from the database i get only question marks.
Iam using oracle thin driver and through jdbc
Previous Topic: Can't call Oracle Stored Procedure in ASP
Next Topic: Re: Bigger type length than Maximum
Goto Forum:
  


Current Time: Thu Aug 05 00:52:54 CDT 2021