Special characters show junk in CLOB columns after upgrade to Oracle 19.7.0 with JDBC

When you’d copy & paste the above title into a search engine, you may come across a very similar sounding blog post I wrote two years ago. Today, my dear colleague Dirk asked me on behalf of a customer if it’s possible that this bug is back in 19.7.0. Of course, I said “No”, for sure not. Bug 26380097 was fixed in Oracle 18c already. Gladly, Dirk insisted. So I checked the SR his customer opened.

And now I can write an unplanned blog post about Special characters show junk in CLOB columns after upgrade to Oracle 19.7.0 with JDBC.

What happened in 2018?

The issue from bug 26380097 was fixed in Oracle 18c. Basically this happened because the server sent CLOB data to the client expecting the client to do a conversion. Unfortunately the client (JDBC) didn’t do this conversion. The server shouldn’t send it unconverted but did exactly this. The fix corrected it and handled the conversion of CLOBs on the server side.

I just checked this “old” issue. It looks like as you will need to apply the fix in Oracle 12.2.0.1 still on top of every RU. MOS Note: 26380097.8 tells you more about patch availability.

What happens in 2020?

Well, at first I did check the SR. And in less than 2 hours after opening, the Support engineer had a suspicion:

Not 100% proven yet for this specific customer case. But I read the bug. And I realized that another one of my lead customers is affected as well. What is leading to this issue? The bug indeed does not “re”-happen again. In this case, an optimization done with Oracle 19.7.0 skips the conversion of LOB data happening on the server before, and expects the client to handle this.

This potentially breaks all JDBC clients out there as soon as the database server gets upgraded to 19.7.0. The fix which is undergoing final tests while I write this will revert to previous behavior as far as I can see. But you need to apply a fix.

For clarification, this most likely happens not with Unicode database character sets but typically with WE8ISO character sets such as WE8ISO8859P1, WE8ISO8859P9, WE8ISO8859P15 and WE8MSWIN1252 (just to name some typical examples).

And finally, this of course is not an upgrade bug. The same thing can happen when you patch from 19.5.0 to 19.7.0. It is an issue which gets introduced with Oracle 19.7.0. The MAIN code has been fixed in 21c. I guess we will see backports being requested quickly. Right now, no one-off patches are available. And I don’t see any workaround mentioned in the bug.

You can check with this link for patches for bug 31244237.

And a MOS Note is going to be published – if the link does not work, the not is not public yet and under review:

Further Information and Links

–Mike

Share this: