aspose file tools*
The moose likes Websphere and the fly likes JDBC - As/400 CCSID = 65535 problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "JDBC - As/400 CCSID = 65535 problem" Watch "JDBC - As/400 CCSID = 65535 problem" New topic
Author

JDBC - As/400 CCSID = 65535 problem

Chris Roper
Greenhorn

Joined: Nov 25, 2002
Posts: 17
Hi
I'm hitting the problem where data taken from the AS/400 is displayed as hex/garbage because the file on the AS/400 has a CCSID of 65535.
I've looked around on the net and found a solution, although I've been unable to get it working.
The solution is to basically add a property 'convert binary=true' on to the end of the database URL.
I've tried just adding it to the AS/400 IP address in by WAS datasource, but I can't get a connection.
I've set up a datasource in WAS(4.0.4), and my java code uses this datasource to get the connection. I need to specify the 'convert binary=true' property but don't know how to do it.
Any help greatly appreciated!
Cheers,
Chris
Simon Song
Ranch Hand

Joined: Feb 01, 2002
Posts: 217
Add it as an property to the datasource.


Simon Song
Certified Entperise Developer of Websphere
Chris Roper
Greenhorn

Joined: Nov 25, 2002
Posts: 17
Originally posted by Simon Song:
Add it as an property to the datasource.

I already tried that - I get the old "Could not find the property convert binary on class..." error message. From what I've seen on various lists looking around on the internet, 'convert binary' isn't a valid property.
Am I missing something?
Simon Song
Ranch Hand

Joined: Feb 01, 2002
Posts: 217
>Property is "translate binary=true"
>
>As in the URL
> "jdbc b2:localhost;translate binary=true"
>
>or you could put it in the connection properties object that gets passed on
>the connect methods.
>
>BTW: Its is a feature. ;-) Without some way to represent binary data you
>would not be able to serial java objects and put them into the database
>without data translation happening to them. Also, you could not optimize
>out data translation by putting raw UTF-8 data in the database.
>
>I know... its a little annoying, but its a necessary evil (for now anyway).
>I would like to see the keyword binary and varbinary available on the
>system (and have it used as a real data type - not just a mask over the top
>of CHAR FOR BIT DATA. Maybe someday, but probably not someday soon.
>
>Regards,
>
>Richard D. Dettinger
>AS/400 Java Data Access Team
Chris Roper
Greenhorn

Joined: Nov 25, 2002
Posts: 17
Thanks for the help Simon.
I couldn't get the code I had to work. But I changed the way the connection was being made. The code was getting a datasource from WAS and using this to make the connection, but I changed it to get a connection using an IP address stored in a properties file. This was using different drivers, and I was quite easily able to add the property to it. The facility to at properties just didn't seem to be available when using the datasource.
And I'm aware I typed 'convert' instead of 'translate' - that was just in this posting, not in the code.
So I've got it working, but aren't 100% happy that I had to change all the connection code (the application was written by somebody who has since left our company).
This application is just a demo for a customer, so the fact that it works is fine for now. However, I think my code doesn't use connection pooling and will cause the application to be less efficient.

Cheers,
Chris
[ January 29, 2003: Message edited by: Chris Roper ]
Simon Song
Ranch Hand

Joined: Feb 01, 2002
Posts: 217
I bet it will be much less efficient, especially under heavy load. For a customer demo, it is just fine.
You'd open a PMR against IBM for this issue, or send email to the As/400 Toolkit developer(you may find their email address in the newsgroup).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC - As/400 CCSID = 65535 problem