解决方案 »

  1.   

    检查一下连接数。show processlists;如果有大量连接,则检查你的程序代码为何没有及时释放连接。
      

  2.   

    hibernate definitely connects mysql using a connection pool, you might want to check the config file there make sure you have sufficient spare connections available.I am not familiar with hibernate, check if you have to explicitly close/release connection in your java codes... 
      

  3.   

    1、检测 MYSQL 配置中的错误连接个数是否太小
    2、每次刷新是否以释放原连接
      

  4.   


    确实是代码没有释放连接,代码中查询获取session试过了这几种方法,encodingRulesDao.getHibernateSession().createSQLQuery(sql.toString()),getHibernateTemplate().getSessionFactory().openSession(),
    getHibernateTemplate().getSessionFactory().getCurrentSession(),发现连接都是只增不减。不知是不是哪里没配置对。上网看到说到spring事务管理,会自动管理session的释放,但是貌似没起到效果。
      

  5.   

    ----------------------------------------------------------------------------------------------------
    show processlists;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'processlists' at line 1
    请问这是啥原因?
      

  6.   

    ----------------------------------------------------------------------------------------------------
    show processlists;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'processlists' at line 1
    请问这是啥原因?你的sql写错了,应该是SHOW FULL PROCESSLIST;  或者  SHOW PROCESSLIST;  没有's'
      

  7.   

    大量sql对数据库的连接后,做具体的sql操作,执行完是否释放。
      

  8.   

    tcp连接建立了,但是没释放,超过你设置的最大连接数就这样了。