Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres UTF-8 clobs with JDBC

Postgres JDBC driver seems to not handle UTF-8 clobs correctly. When you retrieve the clob the characters are not correct (you get ? marks for non ascii characters).

Supposedly this is a known issue:

  • http://archives.postgresql.org/pgsql-bugs/2010-09/msg00034.php
  • https://jira.springsource.org/browse/SPR-7520
  • http://archives.postgresql.org/pgsql-jdbc/2011-02/msg00032.php

Luckily for my application I generally avoid clobs so the fields that were clobs I have just made into really big varchars.

How are other people dealing with this limitation?

like image 778
Adam Gent Avatar asked Feb 18 '11 16:02

Adam Gent


1 Answers

Adding @Type(type="org.hibernate.type.StringClobType") to the clob description in hibernate solves it for me.

like image 102
Zubzub Avatar answered Oct 16 '22 15:10

Zubzub