带有JDBC的Postgres UTF-8 Clob [英] Postgres UTF-8 clobs with JDBC
问题描述
Postgres JDBC驱动程序似乎无法正确处理UTF-8 Clob.检索Clob时,字符不正确(对于非ascii字符,您得到?标记).
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
- 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
幸运的是,对于我的应用程序,我通常避免使用Clob,因此将我刚刚制成的Clob字段变成了很大的varchars.
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?
推荐答案
在hibernate的Clob描述中添加@Type(type ="org.hibernate.type.StringClobType")可以为我解决问题.
Adding @Type(type="org.hibernate.type.StringClobType") to the clob description in hibernate solves it for me.
这篇关于带有JDBC的Postgres UTF-8 Clob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!