*
The moose likes JDBC and the fly likes Postgresql jdbc driver - client encoding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Postgresql jdbc driver - client encoding" Watch "Postgresql jdbc driver - client encoding" New topic
Author

Postgresql jdbc driver - client encoding

Preethi Selvaraj
Greenhorn

Joined: Oct 16, 2012
Posts: 2
Hi,

In my project, we are using PostgreSQL jdbc driver for inserting data into db.
The values may contain other languages like Chinese, Japanese, German expressions.

Apart from inserting the English expression, am getting the following exceptions:

2012-10-11 02:41:37,589 [HttpClient-15] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 22P05
2012-10-11 02:41:37,589 [HttpClient-15] ERROR org.hibernate.util.JDBCExceptionReporter - Batch entry 4 insert into summary (value, id, property) values ('Microsoft Windows 7 ??? ', '7', 'Name') was aborted. Call getNextException to see the cause.
2012-10-11 02:41:37,589 [HttpClient-15] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 22P05
2012-10-11 02:41:37,589 [HttpClient-15] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: character 0xe69797 of encoding "UTF8" has no equivalent in "WIN1252"


While start up, client encode will be set to unicode in jdbc.
If we convert the string to unicode and then insert through jdbc it works fine.
Is this the only option? or can we change the client encode according to our need?

Please provide me some suggestions.

Regards,
Preethi.
Preethi Selvaraj
Greenhorn

Joined: Oct 16, 2012
Posts: 2
Hi,

My problem is solved.
I created my database with utf8 encoding option as shown below. After that i can able to insert any language string into database.

CREATE DATABASE sample WITH ENCODING 'UTF8' TABLESPACE sampledb TEMPLATE=template0;

Thanks,
Preethi.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Postgresql jdbc driver - client encoding