0
votes

I have Spring boot Kotlin application running on Tomcat 8.5 on JVM 1.8 and connecting to SAP HANA. I use JdbcTemplate.batchUpdate(<string query>) for inserting data into tables.

I have to deal with German alphabet and that causes some troubles. When I try to write data with SAP HANA Studio correct version of string is written - for example Qualität is written correctly as Qualität. When I use JdbcTemplate.batchUpdate, Qualität is exported as Qualit�t.

How can I force JVM/Kotlin/JDBCTemplate to use other than default charset? Or there is other way how to solve this issue?

My current workaround is to replace these characters with their phonetic version (ä to ae) but I would like to avoid it.

1
JDBC uses UTF to deal with strings which maps to HANA’s strung storage. There is no charset mapping in HANA/JDBC so the problem is either with displaying the result or with whatever happens before the data is inserted into HANA. Does Kotlin/JDBCtemplate perform any data conversions, ie cut characters to ASCII if the column definition is not NCHAR/NVARCHAR?Lars Br.
@LarsBr. column definition is NVARCHAR and that should be Unicode encoding. I would'n say that Kotlin or JdbcTemplate does some magic with that string... But I will try to put query (right before it is executed) into log and will report result.Lukas Forst
@LarsBr. I tried to put query into logfile and result is that query is deformed before being executed, so it is not problem between JDBC and SAP HANA. After some trials and errors, we found out that this was caused by client's network where these characters were being sent malformed.Lukas Forst
Thanks for the update @Delfi. To me, it's surprising that the error-detecting TCP network connection would actually allow garbled characters to be received. I suspect the messing up of the data happens before it actually is put into TCP packets - which would indicate a problem on the sending system.Lars Br.

1 Answers

0
votes

Just to close this one - after some investigation we found out that this was not problem between SAP Hana and Hibernate, but on the testing level, caused by Mozilla Firefox.