伙计们我正在尝试将我的应用程序与MariaDb集成,我根据我的要求创建了预期的数据库和表格,并且我已经将测试数据插入到测试应用程序中。
当我启动应用程序时,我必须从数据库中读取一些配置值以启动系统。
在从其中一个表中读取数据时,我得到了
org.hibernate.util.JDBCExceptionReporter - Invalid collation 'latin1_general_ci'.
我也检查了数据库和表的整理 -
对于数据库 -
SELECT @@character_set_database, @@collation_database;
+--------------------------+----------------------+
| @@character_set_database | @@collation_database |
+--------------------------+----------------------+
| utf8 | utf8_general_ci |
+--------------------------+----------------------+
对于表格
SHOW FULL COLUMNS FROM USM_CONFIGURATION;
+---------------------+--------------+-----------------+------+-----+---------+----------------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+---------------------+--------------+-----------------+------+-----+---------+----------------+---------------------------------+---------+
| ID | bigint(20) | NULL | NO | PRI | NULL | auto_increment | select,insert,update,references | |
| ELEMENT_TYPE | int(11) | NULL | NO | | NULL | | select,insert,update,references | |
| INTERNAL_NAME | varchar(64) | utf8_general_ci | NO | | NULL | | select,insert,update,references | |
| PARENT_ID | bigint(20) | NULL | YES | MUL | NULL | | select,insert,update,references | |
| CONFIGURATION_ORDER | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| HIDDEN | smallint(6) | NULL | NO | | NULL | | select,insert,update,references | |
| READ_ONLY | smallint(6) | NULL | NO | | NULL | | select,insert,update,references | |
| REMOVABLE | smallint(6) | NULL | NO | | NULL | | select,insert,update,references | |
| ALLOW_BLANK | smallint(6) | NULL | NO | | NULL | | select,insert,update,references | |
| PREFERENCE | smallint(6) | NULL | NO | | NULL | | select,insert,update,references | |
| TEMPLATE | smallint(6) | NULL | NO | | NULL | | select,insert,update,references | |
| DISPLAY_NAME_KEY | varchar(64) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
| DISPLAY_NAME | varchar(256) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
| DISPLAY_WIDTH | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| DESCRIPTION_KEY | varchar(256) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
| DEFAULT_KEY | varchar(64) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
| DEFAULT_VALUE | float | NULL | YES | | NULL | | select,insert,update,references | |
| USAGE_NOTE | varchar(256) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
| VALIDATION_CLASS | varchar(256) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
| OWNER | varchar(64) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
| UPDATE_DATE | datetime | NULL | YES | | NULL | | select,insert,update,references | |
| NS_THREAD | int(11) | NULL | NO | MUL | NULL | | select,insert,update,references | |
| NS_LEFT | int(11) | NULL | NO | | NULL | | select,insert,update,references | |
| NS_RIGHT | int(11) | NULL | NO | | NULL | | select,insert,update,references | |
| VERSION | int(11) | NULL | YES | | 0 | | select,insert,update,references | |
+---------------------+--------------+-----------------+------+-----+---------+----------------+---------------------------------+---------+
在数据库和表格中,我都看不到latin1_general_ci整理。
为什么我收到此错误,安装数据库或创建数据库时是否有任何错误。
我已经检查了这个错误的SO答案和其他博客,但找不到任何具体的解决方案。
spring.jpa.properties.hibernate.connection.characterEncoding=utf-8
spring.jpa.properties.hibernate.connection.CharSet=utf-8
spring.jpa.properties.hibernate.connection.useUnicode=true