简体   繁体   中英

oracle jdbc unicode for polish character is not working properly

Hi: We have a tool that is able to handle reports for unicode support. It works fine until we encounter this new report for Polish characters.

We are able to retrieve the data and display correctly, however, when we use the data as input to perform search, it seems not convert some of the character correctly and therefore, not able to retrieve data. Here is an sample.

Table polish has two columns: party, description. One of the value of party is "Bełchatów". I use jdbc to read that value from database and search with the following statement using SQL: SELECT * from polish where party = N'Bełchatów'

However, this give me no result. This is with ojdbc6.jar. (JDK 8) However, this does give me result back with ojdbc7.jar.

What is the reason? And how can we fix when using ojdbc6.jar.

Thanks!

This is because the Oracle JDBC driver doesn't convert the string into unicode character. There is a database property, oracle.jdbc.defaultNChar=true. http://docs.oracle.com/cd/B14117_01/java.101/b10979/global.htm

When this property is true, it will convert the string when it is mark with N'Belchatów' nchart literal into u'Be\\0142chat\\00f3w'.

The user can also set in data source level. Depends on your Persist API vendor, the way to set it can be different.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM