The jbpm deployment process defines the MySQL reporting garbled Solution

Source: Internet
Author: User
Tags jbpm

 

Cause:

When I used ant to deploy process definition and process-related resources to the jbpm database, I reported the following error.

 

Error message, probably:
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 ?? Why ?? '?? R? L \ 0 \ 0? À VF é B | o? R? Why ?? When *?? Ì y ?~? S é j §? 'L6'
At line 1
Jbpm org. hibernate. Exception. sqlgrammarexception: cocould 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.exe cutebatch (abstractbatcher. Java: 275)
At org. hibernate. JDBC. abstractbatcher. preparestatement (abstractbatcher. Java: 114)
At .................

Apparently, the SQL statement encountered a problem when hibernate updated the database! Garbled! My jbpm configuration is inconsistent with the database encoding, leading to garbled characters when sending SQL statements. I thought it was very simple. I could just change the database code. As a result, I had a lot of detours. I would like to summarize the correct solution as follows.

View solution:

1. Disable the MySQL service.

2. In the MySQL installation directory, add the red part to 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. Restart the MySQL service.

4. Check whether the encoding method has been modified:

Open the MySQL console:
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 \ |
+ -------------------------- + ----------------------------------------------------------------- +

In this way, all new databases will adopt UTF-8 encoding.

Note:
1. During the modification of my. ini, the MySQL service may not be started due to improper operations. Therefore, backup is performed before the operation.

2. If the MySQL service is started, Windows cannot start the MySQL service (on a local computer ). Error 10067

Then, refer to the following solution:

Create My. ini
My. ini content:
[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 Server 5.0 /"

# Path to the Database Root
Datadir = "C:/program files (x86)/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 = 5 m
Thread_cache_size = 8
Myisam_max_sort_file_size = 100g
Myisam_max_extra_sort_file_size = 100g
Myisam_sort_buffer_size = 8 m
Key_buffer_size = 8 m
Read_buffer_size = 64 K
Read_rnd_buffer_size = 256 K
Sort_buffer_size = 212 K
Innodb_data_home_dir = "C:/MySQL datafiles /"
Innodb_additional_mem_pool_size = 2 m
Innodb_flush_log_at_trx_commit = 1
Innodb_log_buffer_size = 1 m
Innodb_buffer_pool_size = 8 m
Innodb_log_file_size = 10 m
Innodb_thread_concurrency = 8

 

# Note:
# Note that the red part should be set according to your own installation directory.

Copy the file to the MySQL installation directory and the Windows directory of the system. If it exists, replace it with the original one. Start the MySQL service!

 

I suddenly thought that MySQL on my Linux server is not fully UTF-8 encoded. How can I change it? The general idea is the same as that in windows.

1. Stop MySQL Service (bin/mysqladmin-u root shutdown)

2. Find my. CNF under/etc/. If no, Set
Copy the my-medium.cnf to/etc/and change it to my. CNF.

3. After opening my. CNF, add default-character-set = utf8 under [client] and [mysqld,
Save and close

4. Start MySQL Service (bin/mysqld_safe &)
 

Summary:

This change once and for all, very simple, in the future MySQL All Related default encoding are UTF-8, create a new table without setting again. If MySQL is not installed yet, we recommend that you set the default encoding to utf8 when installing mysql. In our project, we should also set the encoding to utf8, which will avoid many problems in the future. Note that the existing data in the current database still retains the existing encoding method, so you need to perform transcoding on your own,

There are many methods on the Internet, so I will not repeat them here.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.