views:

15

answers:

1

I use teradata and the below query outputs "Altlüd" when run using a teradata client.

select name as name  from MYTABLE where selector=?

Whereas, I get "Altl?d" as the output when I try to execute the query using a java client(jdbc with teradata drivers). I am using "UTF-8" charset and I have also tried Latin charset with no luck.

I have also tried this to troubleshoot.

while (rs.next()) {
 System.out.println(rs.getString(1));
 Reader rd = rs.getCharacterStream(1);
 int charr = rd.read();
 while (charr >= 0) {
    System.out.println(charr + " = " + ((char) charr));
    charr = rd.read();
 }
}

And the output is

Altl?dersdorf 65 = A 108 = l 116 = t 108 = l 65533 = ? 100 = d

If you look at the output produced, the int value for the spl character is 65533 which shouldn't be the case.

Infact it returns 65533 for all the special characters.

Any clues/pointers will be appreciated. Thanks!!!

A: 

Seems to be the Unicode Replacement character U+FFFD. JDBC client and server do not use the same encoding for characters. The client seems to try UTF-8, but the server does offer any non UTF format.

I do not know teradata, but you should look for any database and or server settings for the encoding and/or locale.

Arne Burmeister
Yes. Specifying the charset as LATIN9_OA solved the problem
chedine