0

I using java application and using ojdbc8 to connecting to DB and I have a legacy database set with NLS_LANG set to CL8ISO8859P5. This I cannot change.

And i got problem, when i sending data to DB, it`s replacing unknow characters like « and » to ?

How i can change NLS_LANG for all connections in app or fix this problome on other way?

Daniil Baev
  • 69
  • 1
  • 8
  • imo, that is not an encoding issue on client side, just ISO 8859-5 encoding does not have those symbols (« and ») - database unable to store them as varchar. Have you any issues with cyrillic symbols? – Andrey B. Panfilov Jul 04 '22 at 13:46
  • Yep, it doesn`t contains it, i have`t any troubles with any "cyrillic symbols" – Daniil Baev Jul 04 '22 at 13:53
  • Java/JDBC does not use `NLS_LANG`, see [Database JDBC Developer's Guide - Globalization Support](https://docs.oracle.com/database/121/JJDBC/global.htm#JJDBC28643): *Starting from Oracle Database 10g, the `NLS_LANG` variable is no longer part of the JDBC globalization mechanism. The JDBC driver does not check NLS environment. So, setting it has no effect.* – Wernfried Domscheit Jul 04 '22 at 14:00

1 Answers1

1

« and » do not exit in ISO 8859-5 (aka. CL8ISO8859P5). If you cannot change the characters set then there is no solution.

Either do not use « and » or try NCHAR/NVARCHAR2 data type, which typically supports a wider set of characters.

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110