Hi all,
I'm trying to figure out how Rails handles database connections. The business problem is: * My users have access to multiple, structurally identical schemas * So, for each request, Rails needs to be able to talk to a different schema * It's essential that users not pull data from the wrong schema
A couple more rules: * During the request, the schema used will not change * All the schemas can be accessed from one database server using one set of login credentials
The solution I'm contemplating is to execute a "use" statement for each request, so that all subsequent queries use the correct table.
My questions are: * How many database connections does each Rails process create? * Does this vary by adapter? (I'm using MS SQL Server) * Does apache pool database connections in any way? * Are database connections independent of Rails processes on apache?
Thanks! Daniel