When I retrieve data from EBCDIC based machines, particularly IBM mainframes and AS/400s, sometimes I get what appears to be garbage. Why and how do I resolve the issue?

Joe Sam Shirah

These machines use CCSIDs ( Coded Character Set Identifiers ) for National Language Support. While in general, data will be converted sensibly for Java, under certain conditions data will be created, often inadvertently, with a CCSID of 65535. This code means "binary data, do not convert." While the best answer is to get the data to a proper CCSID, this is not always possible and a good JDBC driver for these platforms will have a property like "convert binary" or "translate CCSID 65535 data." Set this property and the garbage ( which is actually EBCDIC data being displayed on an ASCII machine, ) becomes good data.