JBoss 6.x : Retrieve Datasource properties ( username, database name, password) at runtime, using JMX


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, you do not need to create any database connections or bother what is the name of: database, username/password 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 properties describing predefined Datasources.

If you just need a list of available datasources, without their properties, you can read this post: list available datasources on JBoss 6.

Read more of this post