Java__chuchu
Clown_悠哈
2014-05-18 18:26

hibernate+c3p0连接池,插入数据程序运行一会就卡住

  • 连接池
  • hibernate
  • c3p0

程序是一个导入Excel数据的工具,excel中有好几千条数据,但是程序运行一会,每次都是导入24条以后程序就不运行了,程序好像处于挂起状态一样,卡住了,控制台上也不再打印hibernate日志信息,不知道什么原因,有没有会的看一下,谢谢!

 

 

 

hibernate.cfg.xml配置如下:

<?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>

        <!-- Database connection settings -->
        <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@127.0.0.1:1521:orcl</property>
        <property name="connection.username">bps</property>
        <property name="connection.password">bps</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.OracleDialect</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>

        <!-- Disable the second-level cache -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- C3P0连接池设定 -->
        <property name="hibernate.connection.provider_class">org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider</property>
        <property name="hibernate.c3p0.max_size">100</property>
        <property name="hibernate.c3p0.min_size">30</property>
        <property name="hibernate.c3p0.timeout">5000</property>
        <property name="hibernate.c3p0.max_statements">100</property>
        <property name="hibernate.c3p0.idle_test_period">3000</property>
        <property name="hibernate.c3p0.acquire_increment">2</property>
        <property name="hibernate.c3p0.validate">false</property>

        <!-- 映射文件 -->
        ...
    </session-factory>
</hibernate-configuration>

 

 

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答