What to do when the database server is in another place

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:inexecute’
/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:inselect’
/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:inselect_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:infind_every’