On Tuesday 21 September 2010, michael_teter wrote: > Yes, I'm making the connection in my model as you describe. That is > working fine in the sense that it is connecting to the secondary > database. > > My problem is, it appears to be connecting every time I instantiate > that object. I've traced the entire establish_connection path, and > it appears to be creating a new ConnectionPool object each time. > What's happening in establish_connection() is a little confusing to > me. > > As far as I can tell, there is no re-use of connections to the > secondary database.
Something's suspicious here. The behavior of establish_connection is correct (I think), but I don't see why it would be called more than twice for each instance of your app. Once each for the primary and secondary database. If establish_connection is called more often than that in the production environment(!) you ought to investigate the reason. Usually, class caching is enabled there and connections are retained across requests. Another angle of attack is to set a breakpoint (or puts caller) somewhere deep down in the database adapter to see when and from where connections are established. Michael -- Michael Schuerig mailto:[email protected] http://www.schuerig.de/michael/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

