2008-03-19

Weblogic datasource error: Locale not recognized after upgrading Oracle driver 9 -> 10

My company had developed a system that had been running in Sweden for years. Platform: Java, Weblogic, Oracle.

Recently, we decided to upgrade the Oracle thin driver from version 9 to 10.
Right after restart, we experienced a really odd problem: getConnection() calls failed with "Locale not recognized" error.

First I thought there is something to do with the database supported locale, partly because now we have to use orai18n.jar instead of orcs12.jar, but it was not the case.

This is the way to find out database locale settings:

select * from SYS.NLS_DATABASE_PARAMETERS

It was nothing Sweden specific, so there should be no problem with the database locale.

Then, I decided to debug the Oracle driver (credits to JadClipse ), and it turned out that Oracle 10 driver has something like this inside:

String s9 = CharacterSetMetaData.getNLSLanguage(Locale.getDefault());
if (s9==null) throw ....

...and this is where the exception caught comes from.

Ok, we are really close now.
Locale.getDefault() resulted locale se_SE.
(We are using different language resource files, and we set the default locale to this after reading the configs.)

But hey, shouldn't CharacterSetMetaData.getNLSLanguage support se_SE?
Actually, it shouldn't. Just check out the list of Supported Locales by Sun. It is sv_SE and not se_SE!! LOL!!