Java 如何修复IJ中MySql服务器错误的连接Url
我在项目中有Web、MySQL、Hibernet和JPA。 配置如下:Java 如何修复IJ中MySql服务器错误的连接Url,java,mysql,hibernate,jpa,Java,Mysql,Hibernate,Jpa,我在项目中有Web、MySQL、Hibernet和JPA。 配置如下: <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc
<hibernate-configuration> <session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/springboot_hibernat</property>
<property name="hibernate.connection.username">root</property>
<property
name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
<property name="Hbm2ddl.auto">update</property>
<property name="show_sql">true</property> </session-factory> </hibernate-configuration>[enter image description here][1]
com.mysql.jdbc.Driver
jdbc:mysql://localhost:3306/springboot_hibernat
根
org.hibernate.dialogue.mysql5dialogue
使现代化
true[在此处输入图像描述][1]
我认为项目的类路径中缺少MySQL/JDBC jar。请从项目中添加jar。
从这里下载:
注意:请注意MySQL/JDBC版本
对于版本>8.x,驱动程序类将是com.mysql.cj.jdbc.driver
正确的hbm.xml文件如下所示:
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/springboot_hibernate</property>
<property name="connection.user">root</property>
<property name="connection.password">password</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hbm2ddl.auto">update</property>
</session-factory>
</hibernate-configuration>
com.mysql.jdbc.Driver
jdbc:mysql://localhost:3306/springboot_hibernate
根
暗语
符合事实的
org.hibernate.dialogue.mysqldialogue
使现代化