Well, first of all you need a DataSource for each database. In 2.4.x you will probably set these up using XADataSourceLoader mbeans in jboss.jcml. Make sure each mbean has a unique name and the jndi names are unique ("PoolName" I think?) My experience is that you can get these datasources in your code at java:/. You can also translate these names using I think a resource-ref element.
To use cmp, I think you need a jaws.xml file for each ejb jar in the ear saying which datasource to use. Consult the manual.