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 IBM DB2 AS400 data encoding issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "IBM DB2 AS400 data encoding issue" Watch "IBM DB2 AS400 data encoding issue" New topic

IBM DB2 AS400 data encoding issue

echarish Kumar
Ranch Hand

Joined: Feb 02, 2010
Posts: 44

We are using IBM DB2 AS400 DB and we have a leagacy DB which is being encoded with EBCDIC encoding to store japanese double byte characters, the problem is when i am trying to access this with JAVA code i am getting all junk characters. can anyone help with this as how to convert the Result set data to a proper values.

here is the example of the junk charater
ギフケン ヨウロウグン , ヨウロウチヨウ , ァ£ァカ・ォゥ`ゥオゥヒ

These are the three sample columns having double byte Katakana and Kanji characters but when i fetch them with java i get this junk characters.

Any help regarding PLEASE.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

EBCDIC? Which kind of EBCDIC is that?

And when you access the data, which database driver are you using? And what parameters did you specify in the JDBC URL? Does the driver have parameters for specifying charset?

And what characters are you actually seeing? What you posted looks like Japanese to me, so "all junk characters" doesn't agree with what you posted. Also, how are you displaying the characters? Did you check them as soon as you got them from the database, or did you do something else with them (like displaying them at the console) as well?

You're going to have to look at the details. Just telling us you have a problem isn't helpful.
echarish Kumar
Ranch Hand

Joined: Feb 02, 2010
Posts: 44

Encoding at DB is
CCSID 5035 (decimal)
13AB (hex)

here are the details
driver = ""
url = "jdbc:as400B_IP;prompt=false"

the Output charactes which i have written those i have took from the Debug in Eclipse, and even when i print them on console they are printed the same.
And yes these characters looks like japanese but they are suppose to be Double Byte Characters, but they get converted.
subject: IBM DB2 AS400 data encoding issue
It's not a secret anymore!