问题
I have Oracle 11 database to which I connect using both JDBC and ODBC. JDBC works well, but in ODBC all Polish letters in SELECT
result are changed to Latin equivalent, for example ą
-> a
, Ó
-> O
etc. I tested it with my application and simple Python program that uses odbc
module. The same value from database is returned as:
ZAMOŚĆ - by JDBC
ZAMOSC - by ODBC
My environment:
DB server: Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
Client machine:
- Windows Server 2008 R2 64 bit
- Oracle clients in 32 bit and 64 bit versions in:
c:\Oracle\Ora1120_32bit
andc:\Oracle\Ora1120_64bit
- ODBC manager reports Oracle driver version as: 11.02.00.01
I think that all locales are set to Poland/Polish, but they are not visible
by SET
command line utility.
Anybody knows what ODBC or environment setting is responsible for translation of Polish letters into Latin equivalents?
回答1:
I suspect the value of the client character set is not the same in both cases. Can you check the value of your NLS_LANG setting:
- since you are on Windows, it should be set in the registry (probably HKEY_LOCAL_MACHINE -> SOFTWARE -> ORACLE -> YOUR_HOME -> NLS_LANG)
- you've found that this doesn't solve your problem, however adding an environment variable NLS_LANG did work !
来源:https://stackoverflow.com/questions/4955363/oracle-odbc-why-are-national-characters-changed-to-latin-equivalent-in-select-r