JBoss 7: Retrieve list of configured datasources at runtime


Working with database connections on enterprise application servers like JBoss is in 99.9% very simple and well standardized. After configuring your environment, you can use JPA in order to handle all database interactions. In that way, during coding, you do not need to create any database connections or bother what is the name of database as well as datasource name. However, there is this 0.1% of cases in which your application is extraordinary (been there ;-) ) and you need to have some more information and control over your database connections. If you do, in this post you will find how to retrieve a list of available datasources.
Read more of this post