# Db connection issues in production but not in dev mode

**URL:** <https://www.ruby-forum.com/t/db-connection-issues-in-production-but-not-in-dev-mode/189883>\
**Category:** Rails\
**Created:** [June 9, 2010, 2:38pm UTC](https://www.ruby-forum.com/t/db-connection-issues-in-production-but-not-in-dev-mode/189883 "2010-06-09T14:38:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yani\_engico](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/919ad9/32.png) [@yani\_engico](https://www.ruby-forum.com/u/yani_engico)\
**Post date:** [June 9, 2010, 2:38pm UTC](https://www.ruby-forum.com/t/db-connection-issues-in-production-but-not-in-dev-mode/189883/1 "2010-06-09T14:38:56Z")

</div>

We have an application Ruby on rails, which fires a number of queries to  
the database. I Suspect it is connection timeout error or something

## When we run the application in development mode, it works as expected. However when we switch to Production mode, we get the following error in Postgre console:

LOG: could not receive data from client: No connection could be made  
because th  
e target machine actively refused it.

## LOG: unexpected EOF on client connection

Entries in database.yml file are as follows:

development:  
adapter: jdbcpostgresql  
database: microblogging  
username: databaseusername  
password: databasepassword  
pool: 15  
timeout: 15000

production:  
adapter: jdbcpostgresql  
database: microblogging  
username: databaseusername  
password: databasepassword  
pool: 15  
timeout: 15000

Environment:  
Jruby version 1.5.0  
Rails version 2.3.5  
Postgre SQL database  
Internal WEBrick server

---

<div class="post-metadata">

**Author:** ![yani\_engico](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/919ad9/32.png) [@yani\_engico](https://www.ruby-forum.com/u/yani_engico)\
**Post date:** [June 9, 2010, 3:23pm UTC](https://www.ruby-forum.com/t/db-connection-issues-in-production-but-not-in-dev-mode/189883/2 "2010-06-09T15:23:52Z")

</div>

Forgot to mention:

There are 4 asynchronous queries being fired. Out of these 3 get fired  
and result is achieved as expected, however the 4th query doesnt produce  
any result

There are no exceptions thrown neither any log created.  
However in Postgre Sql console the stack trace is as previously  
mentioned.

Yani Y. wrote:

> We have an application Ruby on rails, which fires a number of queries to  
> the database. I Suspect it is connection timeout error or something
> 
> ## When we run the application in development mode, it works as expected. However when we switch to Production mode, we get the following error in Postgre console:
> 
> LOG: could not receive data from client: No connection could be made  
> because th  
> e target machine actively refused it.
> 
> ## LOG: unexpected EOF on client connection
> 
> Entries in database.yml file are as follows:
> 
> development:  
> adapter: jdbcpostgresql  
> database: microblogging  
> username: databaseusername  
> password: databasepassword  
> pool: 15  
> timeout: 15000
> 
> production:  
> adapter: jdbcpostgresql  
> database: microblogging  
> username: databaseusername  
> password: databasepassword  
> pool: 15  
> timeout: 15000
> 
> Environment:  
> Jruby version 1.5.0  
> Rails version 2.3.5  
> Postgre SQL database  
> Internal WEBrick server

---

<div class="post-metadata">

**Author:** ![yani\_engico](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/919ad9/32.png) [@yani\_engico](https://www.ruby-forum.com/u/yani_engico)\
**Post date:** [June 9, 2010, 5:46pm UTC](https://www.ruby-forum.com/t/db-connection-issues-in-production-but-not-in-dev-mode/189883/3 "2010-06-09T17:46:06Z")

</div>

Thank you, that was a mistake made by me while writing here my  
production database is microblogging\_production.

The postgreSQL database version 8.3.7

Gem list :

\*\*\* LOCAL GEMS \*\*\*

actionmailer (2.3.5)  
actionpack (2.3.5)  
activerecord (2.3.5)  
activerecord-jdbc-adapter (0.9.7, 0.9.2)  
activerecord-jdbcmysql-adapter (0.9.2)  
activerecord-jdbcpostgresql-adapter (0.9.7)  
activeresource (2.3.5)  
activesupport (2.3.5)  
columnize (0.3.1)  
jdbc-mysql (5.0.4)  
jdbc-postgres (8.4.701)  
jruby-jars (1.5.0)  
jruby-openssl (0.7)  
jruby-rack (1.0.0)  
mysql (2.8.1)  
rack (1.0.1)  
rails (2.3.5)  
rake (0.8.7)  
rspec (1.3.0, 1.2.9)  
ruby-debug (0.10.3)  
ruby-debug-base (0.10.3.2)  
rubyzip (0.9.4)  
sources (0.0.1)  
warbler (1.0.3)

Thank you.

Marnen Laibow-Koser wrote:

> Yani Y. wrote:
> 
> > We have an application Ruby on rails, which fires a number of queries to  
> > the database. I Suspect it is connection timeout error or something
> > 
> > ## When we run the application in development mode, it works as expected. However when we switch to Production mode, we get the following error in Postgre console:
> > 
> > LOG: could not receive data from client: No connection could be made  
> > because th  
> > e target machine actively refused it.
> > 
> > ## LOG: unexpected EOF on client connection
> > 
> > Entries in database.yml file are as follows:
> > 
> > development:  
> > adapter: jdbcpostgresql  
> > database: microblogging  
> > username: databaseusername  
> > password: databasepassword  
> > pool: 15  
> > timeout: 15000
> > 
> > production:  
> > adapter: jdbcpostgresql  
> > database: microblogging  
> > username: databaseusername  
> > password: databasepassword  
> > pool: 15  
> > timeout: 15000
> > 
> > Environment:  
> > Jruby version 1.5.0  
> > Rails version 2.3.5  
> > Postgre SQL database  
> > Internal WEBrick server
> 
> This won’t solve your problem, but it’s a VERY BAD practice to have  
> development and production point to the same DB. You really should be  
> able to play around in your dev sandbox without jeopardizing production  
> data.
> 
> ## Best,
> 
> Marnen Laibow-Koser  
> [http://www.marnen.org](http://www.marnen.org)  
> removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![yani\_engico](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/919ad9/32.png) [@yani\_engico](https://www.ruby-forum.com/u/yani_engico)\
**Post date:** [June 9, 2010, 4:44pm UTC](https://www.ruby-forum.com/t/db-connection-issues-in-production-but-not-in-dev-mode/189883/4 "2010-06-09T16:44:56Z")

</div>

Yani Y. wrote:

> We have an application Ruby on rails, which fires a number of queries to  
> the database. I Suspect it is connection timeout error or something
> 
> ## When we run the application in development mode, it works as expected. However when we switch to Production mode, we get the following error in Postgre console:
> 
> LOG: could not receive data from client: No connection could be made  
> because th  
> e target machine actively refused it.
> 
> ## LOG: unexpected EOF on client connection
> 
> Entries in database.yml file are as follows:
> 
> development:  
> adapter: jdbcpostgresql  
> database: microblogging  
> username: databaseusername  
> password: databasepassword  
> pool: 15  
> timeout: 15000
> 
> production:  
> adapter: jdbcpostgresql  
> database: microblogging  
> username: databaseusername  
> password: databasepassword  
> pool: 15  
> timeout: 15000
> 
> Environment:  
> Jruby version 1.5.0  
> Rails version 2.3.5  
> Postgre SQL database  
> Internal WEBrick server

This won’t solve your problem, but it’s a VERY BAD practice to have  
development and production point to the same DB. You really should be  
able to play around in your dev sandbox without jeopardizing production  
data.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![yani\_engico](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/919ad9/32.png) [@yani\_engico](https://www.ruby-forum.com/u/yani_engico)\
**Post date:** [June 10, 2010, 7:03am UTC](https://www.ruby-forum.com/t/db-connection-issues-in-production-but-not-in-dev-mode/189883/5 "2010-06-10T07:03:12Z")

</div>

Hi, my postgreSQl error went by changing the postgres adapter to  
8.3.604…

Thanks…
