I have an application that access two different DBMS - Firebird
and Postgres. So far, that’s ok. The problem is, depending on the
customer logged, a different database (Firebird) must be selected.
To make the things clearer:
Postgres: 1 database shared by all customers with these tables:
Firebird: several databases with different names and identical structure
with this table:
Each customer has a firebird database. The name of the customer
determines the database name:
- Customer name: C1 - Database name: C1.fdb - Customer name: C2 - Database name: C2.fdb - Customer name: C3 - Database name: C3.fdb ...
- User (postgres) - Vehicle (postgres) - Driver (postgres) - Gps (firebird)
If the customer C1 is logged, the Gps class must be associated to
table Gps in C1.fdb, C2.fdb if customer C2, and so on.
How could I do this choice at runtime?
Is there a way to set table name in environment.rb file dynamically?
Is there another way to switch the database without setting
I’ve tried to do this just setting connection at Gps class but it didn’t
:adapter => “firebird”,
:host => “localhost”,
:database => customer_name,
:username => “SYSDBA”,
:password => “masterkey”)
Does anybody have any idea?
Thanks a lot!