【发布时间】:2018-07-05 17:25:01
【问题描述】:
在 hibernate.cfg.xml 中
我正在使用 MariaDBDialect 类
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/Book</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.connection.pool_size">1</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.MariaDBDialect</property>
<mapping class="com.yazeed.brain.dto.User" />
</session-factory>
当我运行我的代码时,我在控制台中遇到了这个错误
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.hibernate.exception.SQLGrammarException: Error calling Driver#connect
Caused by: java.sql.SQLSyntaxErrorException: Unknown database 'book'
【问题讨论】: