这个和hibernate没有关系啊,主要还是看你采用的连接池的配置方式,不同连接池包的配置方式是不同的,比如c3p0或dbcp或proxool等,每个连接池都有无限连接的方法,就看你用哪个了,去参考一下每个连接池的配置文件就知道了。

解决方案 »

  1.   

    回复人: mxlmwl(飞星) ( ) 信誉:100  2005-09-16 09:42:00  得分: 0  
     
     
       这个和hibernate没有关系啊,主要还是看你采用的连接池的配置方式,不同连接池包的配置方式是不同的,比如c3p0或dbcp或proxool等,每个连接池都有无限连接的方法,就看你用哪个了,去参考一下每个连接池的配置文件就知道了。
      
     
    -------------------------------
    关注,前几天还想就这个问题,问呢!
      

  2.   

    比如对于c3p0来讲,acquireRetryAttempts这个参数,如果>0就是你指定的连接次数,如果<0则表示无限制的连接。
      

  3.   

    增加配置文件c3p0.properties
       增加配置项如下:
    #Defines how many times c3p0 will try to acquire a new Connection from the database 
    #before giving up. 
    #If this value is less than or equal to zero, c3p0 will keep trying to fetch a Connection 
    #indefinitely.
    acquireRetryAttempts=60#Milliseconds, time c3p0 will wait between acquire attempts.
    acquireRetryDelay=60000#If true, a pooled DataSource will declare itself broken and be permanently closed if a 
    #Connection cannot be obtained from the database after making acquireRetryAttempts to 
    #acquire one.
    #If false, failure to obtain a Connection will cause all Threads waiting for the pool to
    # acquire 
    #a Connection to throw an Exception, but the DataSource will remain valid, and will 
    #attempt to 
    #acquire again following a call to getConnection(). 
    breakAfterAcquireFailure=false
      

  4.   

    呵呵,如果我使用的是hibernate默认的连接池,那又怎么配置啊?请多指教