Question

I am new to SQuirrel SQL. I need some help to translating CCSID 65535 into ASCII, UNICODE (or anything human readable)

I am using the JDBC driver per the following guide.


According to IBM's website:

What character conversion issues must my program deal with? The IBM i database uses EBCDIC to store text. Java uses Unicode. The JDBC driver handles all conversion between character sets, so your program should not have to worry about it.

but I think they refer to CCSID 37 and not 65535(Hex).


I have got the following info, from my DB2 DB

Doing DSPFD gives me:

Coded character set identifier . . . . . . : CCSID 65535

Doing DSPFFD gives me:

TXT     CHAR            3       3        41        Both     Text      
Field text  . . . . . . . . . . . . . . . :  Text   Coded Character
Set Identifier  . . . . . :  65535

But the SQuirrel query result for the TXT field is:

5c c1 c4 c4 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 c1 40 7e 40 c2 40 4e 40 c3 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40

Which should be translated to something like:

*ADD                      A = B + C
Was it helpful?

Solution

From the JDBC FAQ:

Why is the Toolbox JDBC returning EBCDIC characters to my Java program?

Normally, the Toolbox JDBC driver will translate EBCDIC characters to Unicode Strings automatically. If it appears to be returning untranslated EBCDIC characters instead, then it is likely that the field in the IBM i database is tagged with CCSID 65535. The Toolbox JDBC driver recognizes this CCSID as a field that should not be translated. To avoid this behavior, tag fields on the IBM i that you want to be translated, with a valid CCSID. Alternately, you can set the "translate binary" connection property to "true", which instructs the JDBC driver to translate all fields, including those tagged with CCSID 65535. The easiest way to do this is to add

";translate binary=true"

to the end of the URL used when connecting to the database.

OTHER TIPS

In my case it was not sufficient enough, the file contained Polish characters and has a ccsid of 65535. After changing the line to ";translate binary=true;ccsid=870;" it worked.

Yet still one warning: if used within a join the ccsid is lost.

I am using Squirrel to connect to an IBMi running 7.3. I had this same issue and was able to resolve by following these steps:

Right click on the Alias select Modify from the context menu (may want to create a copy and then modify that copy). Click on the Properties button in the Change Alias xxxxx dialogue box. Choose the Driver properties tab. Select User driver properties Scroll down the list of properties until you find translate binary. Select the box on that row in the Specify column. Click on the Value cell of that row and choose true Click Ok Fill in your user credentials. Click Ok

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top