{"id":313,"date":"2016-01-20T10:21:18","date_gmt":"2016-01-20T14:21:18","guid":{"rendered":"http:\/\/dbtricks.com\/?p=313"},"modified":"2016-01-20T10:24:47","modified_gmt":"2016-01-20T14:24:47","slug":"a-short-reminder-sqlexception-unsupported-character-set-add-orai18n-jar-to-your-classpath","status":"publish","type":"post","link":"https:\/\/dbtricks.com\/?p=313","title":{"rendered":"A short reminder &#8211;  SQLException: Unsupported character set  (add orai18n.jar to your classpath)"},"content":{"rendered":"<p>After upgrading one of our testing environments to a newer oracle version, some of our services started to return the following error:<\/p>\n<p>SQLException: Unsupported character set  (add orai18n.jar to your classpath)<\/p>\n<p>From the error message wording, one could suspect that this is an character set but after running <\/p>\n<pre lang=\"sql\">\r\nSelect value from SYS.NLS_DATABASE_PARAMETERS where PARAMETER = 'NLS_CHARACTERSET'; <\/pre>\n<p>We found out that both databases return the same results.<\/p>\n<p>Therefore, it is obvious that there is a version mismatch between the client and the server. And this message is Oracle&#8217;s way of telling you that you need to upgrade your client. Since we are using WebLogic, the process is more complicated. <\/p>\n<p>As suggested, we tried  adding the orai18n.jar to the classpath but to no avail.<\/p>\n<p>In addition we discovered that all the problematic service select xmltype from the Database so we assumed that this issue could be solved by some kind of encoding workaround.<br \/>\nWe tried converting the character set (convert(col1,&#8217;IW8ISO8859P8&#8242;,&#8217;UTF-8&#8242;); )  or tweaking the NLS settings (alter session set nls_territory) only to discover that <strong>the simple solution is to convert the xmltype to string and reconverting it back to xmltype<br \/>\n<\/strong><\/p>\n<pre lang=\"sql\">\r\nselect XMLELEMENT(\"RESULTS\",\r\n                    XMLELEMENT(  \"Field\",XMLATTRIBUTES(col_name_1 as \"name\") ,col_value_1 ),\r\n                    XMLELEMENT(  \"Field\",XMLATTRIBUTES(col_name_2 as \"name\") ,col_value_2 )\r\n                    \r\n                    )\r\n                                    \r\ninto xml --  xmltype \r\nfrom (select     \r\n        'NAME1' as col_name_1\r\n        ,'VALUE1' as  col_value_1\r\n        ,'NAME2' as col_name_2\r\n        ,'VALUE2' as  col_value_2 \r\n from dual   \r\n        );\r\n\r\nreturn xmltype(to_clob(xml.getStringVal()));\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>After upgrading one of our testing environments to a newer oracle version, some of our services started to return the following error: SQLException: Unsupported character set (add orai18n.jar to your classpath) From the error message wording, one could suspect that this is an character set but after running Select value from SYS.NLS_DATABASE_PARAMETERS where PARAMETER = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[90,91],"class_list":["post-313","post","type-post","status-publish","format-standard","hentry","category-oracle","tag-orai18n-jar","tag-xmltype"],"_links":{"self":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts\/313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=313"}],"version-history":[{"count":4,"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts\/313\/revisions"}],"predecessor-version":[{"id":317,"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts\/313\/revisions\/317"}],"wp:attachment":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}