学习hibernate笔记

Could not obtain connection to query metadata : The application must supply JDBC connections
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

1.学习hibernate报如上错误,解决办法:Configuration cfg = new Configuration(); 改成如下形式

       Configuration cfg = new Configuration().configure();

  

The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one

2.写入数据库的时候报乱码错误需要在MySQL上做如下修改

 set global time_zone='+8:00';

3.Failed to introspect Class [org.apache.commons.dbcp.BasicDataSource] from ClassLoader

如果只引入commons-dbcp.jar包会报错,还需要引入commons-pool.jar

原文地址:https://www.cnblogs.com/yehuabin/p/9667283.html