Hi,

On 28/07/05, Bobby Lawrence <[EMAIL PROTECTED]> wrote:
> I don't think OJB has any connection-specific configuration, but you can
> try this code on your insert:
> 
> ClassDescriptor classDescriptor = broker.getClassDescriptor(YourClass.class);
> PreparedStatement statementInsert = 
> broker.serviceStatementManager().getInsertStatement(classDescriptor);
> ((OraclePreparedStatement)statementInsert).setFormOfUse(1, 
> OraclePreparedStatement.FORM_NCHAR);
> broker.serviceStatementManager().bindInsert(statementInsert , 
> classDescriptor, yourObject);
> broker.store(yourObject);
> 
> Obviously, you can change it slightly for an update.

Thanks a lot for your tip! 
It looks like OJB is pretty neatly configurable for those nasty little
issues ;-)
I haven't tested that tip though, but I'm pretty sure it works great.

Instead, I've just asked my DBA to change my database's configuration
to use UTF-8 as its default charset, so that the Oracle thin driver is
able to talk the same speak with the database, without any transcoding
issue.
And now, my code works perfectly well without a change or a particular
Database specific snippet of code.

In conclusion, for those on the list who have a problem with Oracle9i
(+OJB) for storing and retrieving NCHAR/NVARCHAR2/NCLOB columns
containing localized strings, make sure the "NLS_CHARACTERSET"
variable is set to "UTF8" (not an 8-bit charset) and you should be
safe.

-- 
Guillaume Laforge
http://glaforge.free.fr/weblog/?catid=2

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to