hibernate入门会遇到的错误 Unable to create requested service

连接不上数据库 (不一定是出错在连接数据库上)
Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
这liang两个错可能同时出现

错误图示

hibernate入门会遇到的错误 Unable to create requested service

hibernate入门会遇到的错误 Unable to create requested service

可能出现的问题是在
hibernate入门会遇到的错误 Unable to create requested service

检查这个文件(连接数据库相关代码)里的代码有没有出错

图片代码 (*看代码有没有出错)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
	"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
	<session-factory>
		<!-- 1. 数据库相关 -->
		<property name="connection.username">root</property>
		<property name="connection.password">123</property>
		<property name="connection.url">jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=UTF-8</property>
		<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
		<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
		
		<!-- 配置本地事务(No CurrentSessionContext configured!) -->
		<property name="hibernate.current_session_context_class">thread</property>
		
		<!-- 2. 调试相关 -->
		<property name="show_sql">true</property>
		<property name="format_sql">true</property>
		
		<!-- 3. 添加实体映射文件 -->
		<mapping resource="com/zking/entity/user.hbm.xml"/>
		
		
	</session-factory>
</hibernate-configuration>

还可能出错的地方是
hibernate入门会遇到的错误 Unable to create requested service

hibernate入门测试代码


package com.zking.test;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

import com.zking.entity.User;

public class Test {

	public static void main(String[] args) {
		Configuration cnf = new Configuration().configure("/hibernate.cfg.xml");
		SessionFactory sessionFactory = cnf.buildSessionFactory();
		Session session =sessionFactory.openSession();
		Transaction transaction = session.beginTransaction();
		
		User user = new User();
		//新增
//		user.setUserName("zhuzhzu");
//		user.setUserPwd("123");
//		session.save(user);
		
		//修改
//		user.setId(2);
//		user.setUserName("23dddf");
//		user.setUserPwd("123ew");
//		session.update(user);
		
		//删除
//		user.setId(3);
//		session.delete(user);
		
		//查询
		user.setId(3);
		User user2 = session.get(User.class, 2);
		System.out.println(user2);
		
		transaction.commit();
		session.close();
		
		
	}
}