From e74b1bc160575650d4c46b790aa50a954b2f56c4 Mon Sep 17 00:00:00 2001
From: Antoine Rey <antoine.rey@gmail.com>
Date: Tue, 5 Apr 2016 22:05:25 +0200
Subject: [PATCH] #141 Configure Unicode and UTF-8 MySQL database for Chinese
 language

---
 src/main/resources/db/mysql/initDB.sql           | 7 ++++++-
 src/main/resources/spring/data-access.properties | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/db/mysql/initDB.sql b/src/main/resources/db/mysql/initDB.sql
index b90d184..6a98259 100644
--- a/src/main/resources/db/mysql/initDB.sql
+++ b/src/main/resources/db/mysql/initDB.sql
@@ -1,4 +1,9 @@
 CREATE DATABASE IF NOT EXISTS petclinic;
+
+ALTER DATABASE petclinic
+  DEFAULT CHARACTER SET utf8
+  DEFAULT COLLATE utf8_general_ci;
+
 GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc';
 
 USE petclinic;
@@ -57,4 +62,4 @@ CREATE TABLE IF NOT EXISTS visits (
   visit_date DATE,
   description VARCHAR(255),
   FOREIGN KEY (pet_id) REFERENCES pets(id)
-) engine=InnoDB;
\ No newline at end of file
+) engine=InnoDB;
diff --git a/src/main/resources/spring/data-access.properties b/src/main/resources/spring/data-access.properties
index e154d81..567f726 100644
--- a/src/main/resources/spring/data-access.properties
+++ b/src/main/resources/spring/data-access.properties
@@ -26,7 +26,7 @@ jpa.database=HSQL
 # MySQL Settings
 
 #jdbc.driverClassName=com.mysql.jdbc.Driver
-#jdbc.url=jdbc:mysql://localhost:3306/petclinic
+#jdbc.url=jdbc:mysql://localhost:3306/petclinic?useUnicode=true&characterEncoding=UTF-8
 #jdbc.username=root
 #jdbc.password=petclinic
 
-- 
GitLab