oracle 无法打开连接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6408658/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:00:04  来源:igfitidea点击:

Can't open connection

javaoraclehibernateconnection-poolingc3p0

提问by Sam

I develop an applivation with very load(request). I used following technologies in my appliation:

我开发了一个非常负载(请求)的应用程序。我在我的应用程序中使用了以下技术:

  1. Jpa/Hibernate as persistense layer
  2. Spring and Spring Dao
  3. C3p0 as connection pooling
  1. Jpa/Hibernate 作为持久层
  2. 春与春道
  3. C3p0 作为连接池

my problem is : I run my application , when number of request increase, throw exception in persistense layer that"Cannt open connection" I increase oracle max session but my problem not solve I indept in C3p0 document and test its options but my problem not solve.

我的问题是:我运行我的应用程序,当请求数量增加时,在持久层抛出异常“无法打开连接”我增加了 oracle 最大会话但我的问题没有解决我独立于 C3p0 文档并测试其选项但我的问题没有解决.

Thank you for your attention

感谢您的关注

采纳答案by Ryan Stewart

You increased max sessions on Oracle, but you didn't increase the max size of your connection pool. The exception is telling you that your pool is exhausted. Either find what's holding connections open and get them released sooner, or increase the number of max active connections in the pool.

您增加了 Oracle 上的最大会话数,但没有增加连接池的最大大小。例外情况是告诉您您的池已耗尽。要么找到保持连接打开的内容并尽快释放它们,要么增加池中的最大活动连接数。

回答by Andy Mc

Is it possible for you to post the Spring configuration for your DataSource. I would expect something like:

您是否可以发布数据源的 Spring 配置。我希望是这样的:

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/>
  <property name="jdbcUrl" value="${jdbc.connection.url}"/>
  <property name="user" value="${jdbc.connection.username}"/>
  <property name="password" value="${jdbc.connection.password}"/>
  <property name="initialPoolSize" value="5"/> 
  <property name="minPoolSize" value="5"/>
  <property name="maxPoolSize" value="100"/>
</bean>

With another bean configured where the dataSource is passed by reference:

配置另一个 bean,其中 dataSource 通过引用传递:

<bean id="mySampleDao" class="com.example.dao.MySampleDao">
  <property name="dataSource" ref="dataSource" />
</bean>

Is this what you have?

这是你所拥有的吗?

What version of Oracle are you using?

您使用的是哪个版本的 Oracle?