我用的hibernate默认的配置连接数据库也就是用hibernate.cfg.xml里配置的:
  配置如下:
  
  
  <?xml version="1.0" encoding="UTF-8" ?> 
  <!DOCTYPE hibernate-configuration (View Source for full doctype...)> 
- <!--  Generated by MyEclipse Hibernate Tools.                   
  --> 
- <hibernate-configuration>
- <session-factory>
  <property name="connection.username">mydata</property> 
  <property name="connection.url">jdbc:mysql://localhost:3306/mydata</property> 
  <property name="dialect">org.hibernate.dialect.MySQLDialect</property> 
  <property name="myeclipse.connection.profile">mydata</property> 
  <property name="connection.password">111111</property> 
  <property name="connection.driver_class">com.mysql.jdbc.Driver</property> 
  <mapping resource="wm/sportweb/po/WebCode.hbm.xml" /> 
  <mapping resource="wm/sportweb/po/WebConfig.hbm.xml" /> 
  <mapping resource="wm/sportweb/po/WebNews.hbm.xml" /> 
  <mapping resource="wm/sportweb/po/User.hbm.xml" /> 
  <mapping resource="wm/sportweb/po/Download.hbm.xml" /> 
  </session-factory>
  </hibernate-configuration>
    
在本机上测试完好,传到服务器后也没有问题,但是第二天访问时,会报错,重起tomcat后网站正常访问,我听说这和mysql8小时会断一次连接有关,请问这个问题应该怎么解决?????谢谢