aspose file tools
The moose likes JDBC and Relational Databases and the fly likes Cp1047 Charecter Encoding to read JDBC string EBCDIC data. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Cp1047 Charecter Encoding to read JDBC string EBCDIC data." Watch "Cp1047 Charecter Encoding to read JDBC string EBCDIC data." New topic
Author

Cp1047 Charecter Encoding to read JDBC string EBCDIC data.

Siva Vu
Greenhorn

Joined: Sep 01, 2004
Posts: 22
Retrieving string from DB2 (Z/OS) (JDBC)
that does contain packed decimal value.

When I am trying to get bytes using String.getBytes("Cp1047"),
I am getting correct bytes for all
Excpet for 15 and 25.
Rather it is resulting in swapped values for these,
i.e, it is getting 25 for 15 and vice versa.

What could be the wrong?
Or should I read bytes directly from ResultSet
using ResultSet.getBinaryStream("COLUMN") ?

Or do 15 and 25 have some special meaning on the
Java Platform.
Thanks in advance.


Siva
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3739
    
  10

If you need data with decimals have you tried getDouble()?


[OCA 8 Book] [Blog]
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Siva,

I had the same problem a few years ago on the z/OS platform.

The Java program did convert it's input to x'15' and after a update of DB2's drivers, it became x'25', and later on it became x'15' again.

We 'solved' this problem outside of the Java-code : the receiving Cobol-program was changed, so that it would accept both x'15' and x'25'.

Herman
Siva Vu
Greenhorn

Joined: Sep 01, 2004
Posts: 22
I am not calling any COBOL programs. I am just retieving rwos with just simple SELECT statement and trying to read the column data that is coming as String.
Arnab Jena
Greenhorn

Joined: May 22, 2012
Posts: 1
Hi All,

Did anyone find any solution for the issue of 25 and 15?
For me the value 25 gets converted to 15 in only come cases and not all.

Best Regards,
Arnab Jena
 
rocket mass heater kickstarter
 
subject: Cp1047 Charecter Encoding to read JDBC string EBCDIC data.