# OCI/Oracle and too many connections?

**URL:** <https://www.ruby-forum.com/t/oci-oracle-and-too-many-connections/121584>\
**Category:** Rails\
**Created:** [November 29, 2007, 2:55am UTC](https://www.ruby-forum.com/t/oci-oracle-and-too-many-connections/121584 "2007-11-29T02:55:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![scarred\_beyond\_beli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90db22/32.png) [@scarred\_beyond\_beli](https://www.ruby-forum.com/u/scarred_beyond_beli)\
**Post date:** [November 29, 2007, 2:55am UTC](https://www.ruby-forum.com/t/oci-oracle-and-too-many-connections/121584/1 "2007-11-29T02:55:57Z")

</div>

Hi,

I have a RoR app which uses an existing Oracle database. It has its  
own user/schema which uses Rails conventions for naming. The data are  
extracted from another schema into views so that we can use these  
conventions.

The problem is that it intermittently throws an  
ActiveRecord::StatementInvalid when trying to update data in the  
application. It seems to be a problem with how the oci adapter handles  
the date format; however, all the data are cleaned up using callbacks  
and validated before submission.

The problem seems most prevalent when there are more people using the  
application (but even at its maximum it would be no more than 30 – it  
is a CRM application for clients of our company to view/update data  
that we maintain for them), which leads me to my question:

Is anyone aware of any problems with OCI/Oracle adapter maintaining  
multiple connections for the same (Oracle) user (schema)?

I am using Rails 1.1.6/Ruby 1.8.4. We have another application which  
uses the same versions and does not seem to have this problem.

Cheers,  
Matt

---

<div class="post-metadata">

**Author:** ![scarred\_beyond\_beli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90db22/32.png) [@scarred\_beyond\_beli](https://www.ruby-forum.com/u/scarred_beyond_beli)\
**Post date:** [November 29, 2007, 4:02am UTC](https://www.ruby-forum.com/t/oci-oracle-and-too-many-connections/121584/2 "2007-11-29T04:02:01Z")

</div>

On Nov 28, 2007 7:55 PM, scarred\_beyond\_belief [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is anyone aware of any problems with OCI/Oracle adapter maintaining  
> multiple connections for the same (Oracle) user (schema)?

Yes, under any serious load the ruby-oci8 driver is buggy for me.  
I’ve experienced threadlocks and other random issues when using it the  
past few months. No real solution to speak of, we just threw more  
hardware at it. It’s working for now.

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)

---

<div class="post-metadata">

**Author:** ![scarred\_beyond\_beli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90db22/32.png) [@scarred\_beyond\_beli](https://www.ruby-forum.com/u/scarred_beyond_beli)\
**Post date:** [November 29, 2007, 4:54am UTC](https://www.ruby-forum.com/t/oci-oracle-and-too-many-connections/121584/3 "2007-11-29T04:54:36Z")

</div>

check your oracle dbms setting for max\_cursors or something like that.  
Increase it if possible. Something like 300 is a good number. IIRC the  
default value is too low. This was a problem for me with some Java stuff  
too. Not saying it’s the answer but it might help.

---

<div class="post-metadata">

**Author:** ![scarred\_beyond\_beli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90db22/32.png) [@scarred\_beyond\_beli](https://www.ruby-forum.com/u/scarred_beyond_beli)\
**Post date:** [December 4, 2007, 3:56am UTC](https://www.ruby-forum.com/t/oci-oracle-and-too-many-connections/121584/4 "2007-12-04T03:56:34Z")

</div>

On Nov 30, 2:49 am, “Greg D.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ## select max(a.value) as highest\_open\_cur, p.value as max\_open\_cur
> 
> Greg D.[http://destiney.com/](http://destiney.com/)

Likewise. My max\_open\_cur is already at 300 also, and the  
highest\_open\_cur no higher than 70 on any of our dbs.

---

<div class="post-metadata">

**Author:** ![scarred\_beyond\_beli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90db22/32.png) [@scarred\_beyond\_beli](https://www.ruby-forum.com/u/scarred_beyond_beli)\
**Post date:** [November 29, 2007, 5:50pm UTC](https://www.ruby-forum.com/t/oci-oracle-and-too-many-connections/121584/5 "2007-11-29T17:50:24Z")

</div>

On Nov 28, 2007 9:54 PM, Brian H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> check your oracle dbms setting for max\_cursors or something like that.  
> Increase it if possible. Something like 300 is a good number. IIRC the  
> default value is too low. This was a problem for me with some Java stuff  
> too. Not saying it’s the answer but it might help.

Thanks but that’s not it. My max cursors is already set to 300. And  
my highest opened count isn’t anywhere near that:

select max(a.value) as highest\_open\_cur, p.value as max\_open\_cur  
from v$sesstat a, v$statname b, v$parameter p  
where a.statistic# = b.statistic#  
and b.name = ‘opened cursors current’  
and p.name= ‘open\_cursors’  
group by p.value;

HIGHEST\_OPEN\_CUR MAX\_OPEN\_CUR

* * *

```
        53 300

```

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)
