2013-12-18 42 views
0

我在嘗試將以下數據保存到數據庫時出錯。Unicode數據不會保存到MySQL數據庫中

•獨立測量和下空間的太陽能電池的性能 校準和* 獨特 *條件(即,高強度/ 溫度,單色和室內照明條件等) •新型能量轉換裝置,如遠程自供電傳感器;寬帶,單色或熱能源; 集成通信/電源概念等

我得到錯誤,因爲我們無法插入到數據庫中的一些不需要的文本(在上面的文本中標記爲粗體和斜體)。數據庫表中的排序規則是「utf8_general_ci」和字符集是「UTF」

Error :: 
*03:20:20,775 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 1366, SQLState: HY000 
03:20:20,775 ERROR [org.hibernate.util.JDBCExceptionReporter] Incorrect string value: '\xF4\x80\x81\xACun...' for column 'VALUE' at row 1 
03:20:20,784 ERROR [com.platform.ejb.OpportunityServicesBean] could not insert: [com.platform.valueobject.OpportunityExtension]: org.hibernate.exception.GenericJDBCException: could not insert: [com.platform.valueobject.OpportunityExtension] 
     at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140) [:3.6.6.Final] 
     at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128) [:3.6.6.Final] 
     at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) [:3.6.6.Final] 
     at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64) [:3.6.6.Final] 
     at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2345) [:3.6.6.Final]* 

如果我將刪除不需要的文本,然後數據被保存到數據庫中。

有人能幫我出來嗎?

+0

它基本上是由於您的列數據類型。在mySQL中將其設置爲unicode。 SQL Server有unicode字符的nVARCHAR(),我不知道mySQL。 – Aditya

回答