I'm not sure about your requirements.
Does appserver1 and appserver2 build a cluster?
If you have two databases how you might control whether the data are in sync? Or do you have two different contents for different clients (with the same table structure) to ensure privacy?
I would say that such scenario is the responsibility of the persistence layer.
Another idea can be to implement your own JCA layer and decide here based on business data which db you use, but there might be cheaper solutions
Actually there was a mistake in the configuration above. Both appservers on each site make one one appserver cluster.
Site A: appserver1a, appserver1b, db1, db2_standby
Site B: appserver2a, appserver2b, db2, db1_standby
db1 and db2 will make up one database cluster. The database cluster will manage the data replication. The problem i am having is i want each application to talk to both db1 and db2. So if appserver1a writes to db1, the database will be replicated to db2. If it writes to db2 the data will be replicated to db1.
The data replication will be taken care of by the database layer. What i am not sure of is how to configure the application server to talk to both databases depending on some business rules.
If the data is replicated why there is a need to decide depend on business rules?
Do you mean db1 == db1_standby? just as standby configuration for that server?
But as I said, you can use two different persistence.jar files which uses different DS or you implement a JCA connector (which might not be trivial).