Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java / AS400

 
Pascal Bayou
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, welcome to the Ranch Pascal!
 
Pascal Bayou
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks

I do the rs.getstring
I Will compare it monday at work...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic