Monday, February 19, 2007

Rails : Maintaining an Oracle connection (preventing a timeout)

Kubo posted a good note about how to maintain an "active" connection to Oracle from Rails. Add the following code at the end of 'config/environment.rb' as a workaround. do |conn|
  # run a SQL every one hour.
  while true
    conn.exec('select 1 from dual') {}

1 comment:

Ohad Asulin said...

Very nice and clean workaround.
I'm going to try and cover this Oracle and Rails specific Issues (one at a time) in this technical blog: