I want to get data from Oracle to insert into MS SQL Server that is I have a string in UTF8 encoding and need to convert to UCS2. How to do this in Java?
Your help is greatly appreciated.
Thanks
It just happens automagically. I read this in the "National Language Support
Guide" book, chapter 6, section "JDBC Class Library".
</code>
http://docs.oracle.com/cd/A81042_01/DOC/server.816/a76966/ch6.htm#8036 <code>
=======================================
The [JDBC] library always accepts US7ASCII, UTF8 or WE8ISO8859P1 encoded
string data from the input stream of the JDBC drivers. It also accepts
UCS2 for the JDBC server-side driver. The JDBC Class Library converts
the input stream to UCS2 before passing it to the client applications.
If the input stream is in UTF8, the JDBC Class Library converts the UTF8
encoded string to UCS2 by using the bit-wise operation defined in the
UTF8-to-UCS2 conversion algorithm. If the input stream is in US7ASCII or
WE8ISO8859P1, it converts the input string to UCS2 by casting the bytes
to Java JDBC characters.
At database connection time, the JDBC Class Library sets the server
NLS_LANGUAGE and NLS_TERRITORY parameters to correspond to the locale of
the Java VM that runs the JDBC driver. This operation is performed on
the JDBC OCI and JDBC Thin drivers only, and ensures that the server and
the Java client communicate in the same language.