无法从基础数据库获取连接

时间:2013-02-18 20:29:08

标签: spring hibernate

我正在使用Spring 3.1,Hibernate 4和MySQL 5.1应用程序,该应用程序在我的本地计算机上运行良好。将应用程序部署到Web主机后,我收到以下错误:

org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Connections could not be acquired from the underlying database!

My Spring applicationContext.xml文件包含:

<bean id="DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  <property name="driverClass" value="org.gjt.mm.mysql.Driver" />
  <property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/brutteng_adaptiveonlinetesting" />
  <property name="user" value="XXXXXXXXXX" />
  <property name="password" value="YYYYYYYYY" />
  <property name="maxPoolSize" value="10" />
  <property name="maxStatements" value="0" />
  <property name="minPoolSize" value="5" />
  <property name="idleConnectionTestPeriod" value="10800"/>
  <property name="maxIdleTime" value="21600"/>
 </bean>

我的hibernate.cfg.xml文件包含:

<session-factory>
        <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://127.0.0.1:3306/brutteng_adaptiveonlinetesting</property>
        <property name="hibernate.connection.username">XXXXXX</property>
        <property name="hibernate.connection.password">YYYYYYY</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
        <property name="c3p0.min_size">5</property>
        <property name="c3p0.max_size">20</property>
        <property name="c3p0.timeout">1800</property>
        <property name="c3p0.max_statements">50</property>
    </session-factory>

请帮助我,因为我陷入了这个问题。

0 个答案:

没有答案