Incorrect string value: '获取...' for column 'result' at row 1

錯誤詳情信息:html

### Error updating database.  Cause: java.sql.SQLException: Incorrect string value: '\xE8\x8E\xB7\xE5\x8F\x96...' for column 'result' at row 1
### The error may involve com.blog.springboot.dao.ApiLogDao.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO wp_api_log   ( class_name,  method_name,  params,  `result`,  consume_time,  update_date )  VALUES   ( ?,  ?,  ?,  ?,  ?,  ? )
### Cause: java.sql.SQLException: Incorrect string value: '\xE8\x8E\xB7\xE5\x8F\x96...' for column 'result' at row 1
; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1366]; Incorrect string value: '\xE8\x8E\xB7\xE5\x8F\x96...' for column 'result' at row 1; nested exception is java.sql.SQLException: Incorrect string value: '\xE8\x8E\xB7\xE5\x8F\x96...' for column 'result' at row 1] with root cause

java.sql.SQLException: Incorrect string value: '\xE8\x8E\xB7\xE5\x8F\x96...' for column 'result' at row 1

錯誤緣由分析:
插入的數據列中,若是是中文的話,則會出現上面的錯誤,若是是英文的話,就不會出現錯誤。
故推測與字段列編碼有關係,果真查看錶對應的字符編碼發現都是latin,最後將其改成utf8便可解決。java

若是想永久解決這樣的問題,可參考該連接:http://www.javashuo.com/article/p-zxgfzfvu-gk.html
上面的問題我好久以前就遇到過,因此那個時候就已經記錄瞭解決的辦法。spring

相關文章
相關標籤/搜索