Oracle, utf-8, NVARCHAR2, and a lot of confusion Oracle, utf-8, NVARCHAR2, and a lot of confusion oracle oracle

Oracle, utf-8, NVARCHAR2, and a lot of confusion


Since you are using bind variables rather than hard-coded literals, you should be able to pass Unicode strings to your UPDATE statement.

If you were using straight JDBC to write to the database, there is an example in the JDBC Developer's Guide on writing data to a NVARCHAR2 column. If you are using a 1.5 JVM, it is necessary to use the OraclePreparedStatement.setFormOfUse call for each NVARCHAR2 column. In a 1.6 JVM, life gets easier because JDBC 4.0 added NCHAR and NVARCHAR2 types. If you are using a 1.5 JVM, getting an ORM framework like Spring to use the Oracle extensions to JDBC may be a non-trivial undertaking. I'm not familiar enough with Spring to know what steps would be necessary for that to happen.

Potentially, you may be able to modify the connection string to specify defaultNChar=true. That will force the driver to treat all character columns using the national character set. That may be enough to resolve your problem without getting Spring to use the OraclePreparedStatement extensions.