Forum: Ruby on Rails What to do when the database server is in another place

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mongeta 9. (Guest)
on 2009-02-04 16:59
Hello,


I'm serving an application, that the database is in another place
(far...).

Once connected, everything is ok, but when you try to login, normally,
the Rails isn't connected, and I'm getting an Status: 500 Internal
Server Error.

If I wait 2 or 3 seconds, the connection with the databse has been
established again and now all works perfect.

Is there a way for Rails to have always the connection opened ?

Maybe I should check for database connection on the first time and
handle the error or the waiting page until the connection has been
established.

Any ideas appreciated .....

thanks,

r.



/!\ FAILSAFE /!\  Wed Feb 04 15:51:41 +0100 2009
  Status: 500 Internal Server Error
  PGError: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
: SELECT * FROM "sessions" WHERE (session_id =
E'059e8560022e9b60b603117a3895a6ae')  LIMIT 1
    /u/apps/scanner/releases/20090202165310/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:188:in
`log'
    /u/apps/scanner/releases/20090202165310/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:503:in
`execute'
    /u/apps/scanner/releases/20090202165310/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1000:in
`select_raw'
    /u/apps/scanner/releases/20090202165310/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:987:in
`select'
    /u/apps/scanner/releases/20090202165310/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in
`select_all_without_query_cache'
    /u/apps/scanner/releases/20090202165310/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in
`select_all'
    /u/apps/scanner/releases/20090202165310/vendor/rails/activerecord/lib/active_record/base.rb:635:in
`find_by_sql'
    /u/apps/scanner/releases/20090202165310/vendor/rails/activerecord/lib/active_record/base.rb:1490:in
`find_every'
This topic is locked and can not be replied to.