1. A system for supporting affinity in a data source and clustered database environment, comprising: a computer, including a computer readable medium and one or more microprocessors; a clustered database system, and a notification service associated with a plurality of database instances in the clustered database system, wherein the notification service broadcasts notifications that describe state changes in the clustered database; an application server environment on the computer, including one or more application server instances therein, wherein each said application server instance is associated with one or more data sources and one or more connection pools, wherein each said data source is associated with one or more affinity policies, each said affinity policy defining one of a session affinity and a distributed transaction (XA) affinity for that data source, wherein the data sources and connection pools are used to manage connections to the plurality of database instances in the clustered database based on the state changes in the clustered database; wherein the session affinity is set as a default affinity policy for each said data source, and wherein the session affinity switches to the XA affinity when the each said data source is accessed outside a context of a session; wherein when the session affinity is triggered for the each said data source, database operations requested by an application during a session are routed to a same said database instance; wherein the routing to the same said database instance is performed by storing routing information to an affinity context, and associating the affinity context with the session using a work context object of the application, wherein the work context object propagates around the system and is accessible to each of the application requests for the database operations.