How to automatically reconnect to pg db

899 views
Skip to first unread message

Loganathan Sellapa

unread,
Feb 14, 2015, 11:26:48 AM2/14/15
to bangal...@googlegroups.com
Hi All, 

I am running my rails 4 application with Postgres db, sometime my db connection getting lost with the below exception 

 PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

And the connection is resuming properly after I restart the application, is their anyway to automatically reconnect to active record connection?


regards,
Loganathan
Mob: +91 7760780741 | +91 9944414388
Skype: loganathan.sellappa
ViewMe

Thiyagarajan Veluchamy

unread,
Mar 3, 2015, 12:00:15 AM3/3/15
to bangal...@googlegroups.com
Hi Loganathan,

change the database.yml like below and check it for reconnect,

development:
  adapter: postgresql
  encoding: unicode
  database: sample_app_development
  pool: 5  
  port: 5433
  username: myusername
  password: mypassword
  reconnect: true

--
You received this message because you are subscribed to the Google Groups "BANGALORE RUG-Ruby Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bangalorerug...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thanks & Regards,
Thiyagarajan Veluchamy
Reply all
Reply to author
Forward
0 new messages