【发布时间】:2020-12-26 14:39:57
【问题描述】:
我想将我的 Java 应用程序连接到 MySQL 数据库。为此,我使用 XAMPP 附带的 MySQL DB。此外,我使用休眠。我已经通过 PostgreSQL 成功地持久化了我的应用程序,但是 MySQL 导致了问题,因为我没有找到正确的方言,尽管我已经尝试了很多不同的方言。
Hibernate: 创建表 keytype (id bigint not null, 主键 (id)) engine=MyISAM 原因:java.sql.SQLSyntaxErrorException:您的 SQL 语法有错误;检查与您的 MariaDB 服务器版本相对应的手册,以在 'key (id bigint not null, idType varchar(255), local bit not null, type varchar(2' at line 1) 附近使用正确的语法
<property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.21'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.4.15.Final'
compile group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.2.1'
数据库
DBMS: MySQL (ver. 5.5.5-10.4.11-MariaDB)
Case sensitivity: plain=lower, delimited=lower
Driver: MySQL Connector/J (ver. mysql-connector-java-8.0.21 (Revision: 33f65445a1bcc544eb0120491926484da168f199), JDBC4.2)
Effective version: MariaDB (ver. 10.4.11)
【问题讨论】:
标签: mysql hibernate jpa xampp mariadb