酷符网数据库 > 正文

org.springframework.jdbc.UncategorizedSQLException解决

2012-01-14 08:33codeif.com

org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO test_content(content_id, content) VALUES (?, ?)]; SQL state [HY000]; error code [1366]; Incorrect string value: ‘\xE3\x80\x80

content是text类型的
后来发现是插入的字符串长度超过了text长度,所以报了上面的错误

补充:
一个BLOB或TEXT列,最大长度为65535(2^16-1)个字符。

MEDIUMBLOB
MEDIUMTEXT
一个BLOB或TEXT列,最大长度为16777215(2^24-1)个字符。

LONGBLOB
LONGTEXT
一个BLOB或TEXT列,最大长度为4294967295(2^32-1)个字符。

解决方案:
将content是类型改为一个更大长度的类型

相关文章

    None Found
新浪微博 | 淘段子 | 我的博客 | 淘宝店铺 | jnan.org | RSS
Copyright © 2009 - 2011 酷符网