日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

jbpm部署流程定義到MySql報(bào)亂碼解決方案

系統(tǒng) 3252 0

?

問題起因:

我在使用ant將流程定義和流程相關(guān)資源部署到JBPM數(shù)據(jù)庫中的時(shí)候,報(bào)了下面一個(gè)錯(cuò)誤。

?

錯(cuò)誤提示,大概是:
11:33:40,781 ERROR JDBCExceptionReporter:101 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EQT??u_??????~?<?q_U?<}?~ü?v??ì??‘??R?L\0\0?àvféb|o?r?ê??ù*??ìy?~?Séj÷ §?’L6' at line 1
jbpm org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
?at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
?at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
?at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
?at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)
?at .................

很明顯是hibernate執(zhí)行更新數(shù)據(jù)庫的時(shí)候sql語句出了問題!亂碼!我的jbpm配置與數(shù)據(jù)庫編碼不一致,導(dǎo)致發(fā)sql語句的時(shí)候出現(xiàn)亂碼。本來以為很簡單,改一下數(shù)據(jù)庫編碼就可以了,結(jié)果走了很多彎路,先把正確方案總結(jié)如下。

看解決方案:


1、關(guān)閉MySql服務(wù)

2、在Mysql的安裝目錄下,在my.ini中添加紅色部分:
[client]
default-character-set=utf8
port=3306

[mysql]

default-character-set=utf8
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]

default-character-set=utf8
# The TCP/IP Port the MySQL Server will listen on
port=3306

?

3、重新啟動Mysql服務(wù)

4、查看編碼方式是否已經(jīng)修改:

打開Mysql控制臺:
mysql> show variables like 'char%';
+--------------------------+---------------------------------------------------------------+
| Variable_name??????????? | Value???????????????????????????????????????????????????????? |
+--------------------------+---------------------------------------------------------------+
| character_set_client???? | utf8????????????????????????????????????????????????????????? |
| character_set_connection | utf8????????????????????????????????????????????????????????? |
| character_set_database?? | gbk?????????????????????????????????????????????????????????? |
| character_set_filesystem | binary??????????????????????????????????????????????????????? |
| character_set_results??? | utf8????????????????????????????????????????????????????????? |
| character_set_server???? | utf8????????????????????????????????????????????????????????? |
| character_set_system???? | utf8????????????????????????????????????????????????????????? |
| character_sets_dir?????? | C:\Program Files (x86)\MySQL\MySQL Server 5.0\share\charsets\ |
+--------------------------+---------------------------------------------------------------+

這樣以后所有新建的數(shù)據(jù)庫都將采用utf-8編碼。

注:
1、在修改my.ini的過程中,可能會因?yàn)椴僮鞑划?dāng),導(dǎo)致Mysql服務(wù)不能啟動,所以操作前先備份。

2、如果啟動Mysql服務(wù)報(bào)windows 無法啟動MySQL服務(wù)(位于 本地計(jì)算機(jī) 上)。錯(cuò)誤10067

那么,參照下面解決方案:

新建my.ini
my.ini內(nèi)容為:
[client]
default-character-set=utf8
port=3306

[mysql]
default-character-set=utf8

[mysqld]
port=3306

#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files (x86)/MySQL/MySQL Server 5.0/"

#Path to the database root
datadir="C:/Program Files (x86)/MySQL/MySQL Server 5.0/Data/"

# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=utf8

# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB

# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=100
query_cache_size=0
table_cache=256
tmp_table_size=5M
thread_cache_size=8
myisam_max_sort_file_size=100G
myisam_max_extra_sort_file_size=100G
myisam_sort_buffer_size=8M
key_buffer_size=8M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=212K
innodb_data_home_dir="C:/MySQL Datafiles/"
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=8M
innodb_log_file_size=10M
innodb_thread_concurrency=8

?

#注:
#注意紅色部分要根據(jù)你自己的安裝目錄進(jìn)行設(shè)定。


將該文件復(fù)制到mysql安裝目錄中和系統(tǒng)的windows目錄中。如果原來存在,替換掉原來的。啟動MySql服務(wù)即可!

?

忽然想到自己的Linux服務(wù)器上的MySql也不完全是utf8編碼的,那怎么改呢?大致思路和在windows下是一樣的。

1、中止MySQL服務(wù)(bin/mysqladmin -u root shutdown)

2、在/etc/下找到my.cnf,如果沒有,就把MySQL的安裝目錄下的support-files目錄下的
my-medium.cnf復(fù)制到/etc/下并改名為my.cnf即可

3、打開my.cnf以后,在[client]和[mysqld]下面均加上default-character-set=utf8,
保存并關(guān)閉

4、啟動MySQL服務(wù)(bin/mysqld_safe &)?
?

總結(jié):

這樣的修改一勞永逸,非常簡單,今后MySQL一切相關(guān)的默認(rèn)編碼均為UTF-8了,創(chuàng)建新表的時(shí)候無需再次設(shè)置。如果MySql還沒有安裝,那么建議在安裝Mysql的時(shí)候,就將默認(rèn)編碼設(shè)置為utf8,我們的項(xiàng)目中也應(yīng)該將編碼設(shè)置為utf8,這樣后續(xù)會規(guī)避很多問題。需要注意的是,當(dāng)前數(shù)據(jù)庫中已經(jīng)存在的數(shù)據(jù)仍保留現(xiàn)有的編碼方式,因此需要自行轉(zhuǎn)碼,

方法在網(wǎng)上有很多,不再贅述。

?

?

?

jbpm部署流程定義到MySql報(bào)亂碼解決方案


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 宣恩县| 虹口区| 塘沽区| 巴中市| 甘孜县| 盐边县| 凤山县| 旺苍县| 红河县| 遂昌县| 台安县| 乌鲁木齐县| 宣恩县| 简阳市| 大邑县| 小金县| 沅陵县| 长治市| 铁力市| 上思县| 宁南县| 岳阳县| 兴宁市| 讷河市| 五原县| 临朐县| 南漳县| 化州市| 郸城县| 昌黎县| 老河口市| 德江县| 宽甸| 米脂县| 容城县| 津南区| 鄯善县| 旺苍县| 馆陶县| 信丰县| 麻城市|