Skip to Content
0
Dec 04, 2006 at 11:23 PM

Problem with Oracle unicode characters

35 Views

I have written an EJB for NW2004s sp9 that reads an oracle database 10g using jdbc and writes that data to SAP via ABAP function modules. I am using the Oracle ojdbc14.jar driver. The problem occurs when the data read has unicode / international characters such as an umlaut.

I am using the getString method of the java.sql.ResultSet object to obtain the results. The column is defined as VARCHAR in the database. The string SÖDERMAN is printed as S?ERMAN in the J2EE log and looks like this in SAP, S�ERMAN.

To troubleshoot, I looped through each character in the string like this:

if (sqlResults.getString(6).length() > 0) {

for (int x1 = 0; x1 < sqlResults.getString(6).length(); x1++) {

tmpChar = (int) sqlResults.getString(6).charAt(x1);

cat.infoT(loc, " char : " + tmpChar);

}

}

and I'm getting these results:

char[0] = 83

char[1] = 65533

char[2] = 69

char[3] = 82

char[4] = 77

char[5] = 65

char[6] = 78

Any advice would be greatly appreciated.

Ray