---
title: "mysql插入中文 "
author: "east_java"
date: "2009-10-22T23:14:05Z"
tags: []
categories: ["企业架构"]
slug: "mysql"
draft: false
lastmod: "2009-10-22T23:14:05Z"
id: 501219
url: "https://japi.iteye.com/blog/501219"
---

```java
 Struts has detected an unhandled exception:
Messages: 	

   1. Incorrect string value: '\xA1\xAA\xA1\xAA\xB0\xFC...' for column 'content' at row 1
   2. Hibernate flushing: Could not execute JDBC batch update; uncategorized SQLException for SQL [insert into blog (comments, content, createdate, description, tid, title, uid, id) values (?, ?, ?, ?, ?, ?, ?, ?)]; SQL state [hy000]; error code [1366]; Incorrect string value: '\xA1\xAA\xA1\xAA\xB0\xFC...' for column 'content' at row 1; nested exception is java.sql.BatchUpdateException: Incorrect string value: '\xA1\xAA\xA1\xAA\xB0\xFC...' for column 'content' at row 1

File: 	com/mysql/jdbc/ServerPreparedStatement.java
Line number: 	657
```


最近在发表文章的时候 却出现了这样的错误。

不知道什么原因 ，在有时插入的时候不会出错  但有时又出错。。

后来发现  原来是mysql的表中字段为gb2312_chinese_ci  而程序中使用的utf-8  这可能是乱码所致。

参考：<http://www.java1995.cn/blog/item/17>