You can have as many datasources as you wish to define. However, in general you infrastructure, if it is defined to use one datasource, will use the one your application references.
For example if the JNDI name your J2EE application references is java:/MyAppDS and that in turn points to the JDBC URL jdbc:postgresql://dbserver:5432/development then it would be accessing the "development" database.
If you wanted to switch your application to use the testing database, you might change the JDBC URL jdbc:postgresql://dbserver:5432/testing.
A J2EE application can reference multiple datasources but they must have different JNDI names.
You probably need to supplement this explanation with some reading on JNDI, J2EE components and resource mapping.
Thanks for that very helpful , at least I'm now looking in the right area . JNDI is the key to all this .