From: Caio Chassot Date: 2004-07-23T04:04:37+09:00 Subject: Re: Problem with ActiveRecord and Cerise David Heinemeier Hansson wrote: >> FYI, I'm currently calling ActiveRecord::Base.establish_connection on >> a file which is required by each page handler. Is this the appropriate >> way to do it? > > Each call to establish_connection will create a new database connection. > So if at all possible, you should try to minimize the number of calls. > In FCGI that would be to have the establish_connection call outside of > the each_cgi block. I'm not sure how it works with Cerise. Hi David, great library. Can't wait for the rest of rails. The appplication persists through requests, so how about keeping the connection in an application-wide variable? By doing so, Michael's solution would no longer apply, so perhaps adding a mutex to the select and execute methods of the adapter would do it?