Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Storing UTF-8 characters into Oracle XE via Hibernate

476967Dec 15 2005 — edited Dec 15 2005
Hi,

I'm developing a Java application that runs in Tomcat 5.5.9 and uses SpringFramework and Hibernate 3.0.5. It used to run with MySQL 5.0 backend just fine, but while Hibernate makes it easy to switch the database I gave Oracle XE for Linux a try.

The problem I hit apperas while storing unicode characters (actually from ISO-8859-2 aka ISO Latin2 subset). From some of them the accents are removed and are effectively converted to ISO Latin1. Few others are saved with accents.

The strange thing is that I can't even change the record via HTMLDB interface - even then the accents are always removed. I suspect the table has been incorrectly created or the database isn't configured for handling unicode data. I have seen a note about Western-only vs. full-unicode OracleXE packages available, however has been offered only one Linux download: oracle-xe-10.2.0.1-0.1.i386.rpm

The hibernate config that I use for Oracle XE is:
<property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@xenora.asterisk:1521:XE</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>

While this one for MySQL works just fine:
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://bobek-x1.home.logix.cz/jsp?useUnicode=true&characterEncoding=UTF-8</property>
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

Note the useUnicode and characterEncoding properties for MySQL - without them it doesn't work either. Maybe I'm missing something similar for Oracle as well?

Any ideas?

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 12 2006
Added on Dec 15 2005
3 comments
8,365 views