File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Java / AS400 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Java / AS400" Watch "Java / AS400" New topic
Author

Java / AS400

Pascal Bayou
Greenhorn

Joined: Dec 07, 2012
Posts: 3
Hello,

i'm using the com.ibm.as400.access.AS400JDBCDriver to access the database.

The database file is in CCSID 297 (french).
The "old system" stores Greek characters in the CCSID 297 field.

Wenn i do my getString of this field and output it in console i have wrong characters like: ¸«Þ»Ð¡¯ÆЧ-

How can i fix it ?

Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18135
    
    8

You did two things in your test: (1) Get the data from the database; (2) Display the data on the console. So what you should do is to test the two things separately. To test (1) your Java code should read a known string from a specific database row and column and test whether it contains the expected data. To test (2), do what you already did.

And this console you used for the test: it isn't the AS/400 operator console, is it? So what exactly is it? A 5250 device, a Windows command line, or what?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18135
    
    8

And, welcome to the Ranch Pascal!
Pascal Bayou
Greenhorn

Joined: Dec 07, 2012
Posts: 3
Thanks.

I have a Java Programm Running in a Windows pc.
The Output is in the netbeans console.
When i get the Data with getstring and put it in a Firebird Database i have Bad Data.

I Friend think the Problem is the greek Data is encoded with french ccsid

How should you do Test 1 ?

Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18135
    
    8

Paul Clapham wrote:To test (1) your Java code should read a known string from a specific database row and column and test whether it contains the expected data.


You need more specific? Okay. Choose a table which contains this Greek-letter data. Choose one row from it. Choose one column which contains some Greek-letter data.

Write an SQL query which selects only that column from only that row in the table. Execute the query in your Java code and get the data from that column into a Java string using rs.getString(1).

Now you know exactly what data you should get. So compare the characters which you get to the Unicode values of the characters which you can see in the database. (Here's a link which tells you the Unicode values of Greek letters: Greek and Coptic.) If they are different, that means that you need to do something with your database connection. If they are the same, then your console is not configured correctly.
Pascal Bayou
Greenhorn

Joined: Dec 07, 2012
Posts: 3
Thanks

I do the rs.getstring
I Will compare it monday at work...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java / AS400
 
Similar Threads
Reading binary data
IBM DB2 AS400 data encoding issue
JDBC - DB2 Native Driver - CCSID Problem
Parsing Chinese Characters by using Xerces
Parsing a XML file with Chinese Character in AS/400