How do I get the list of Datasources available ?

JBOSS AS 4/5 Users

You can use either twiddle:

$ twiddle.sh query "jboss.jca:service=DataSourceBinding,*"

or the JMX Api:


Context ctx = new InitialContext();

MBeanServerConnection mconn = (MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor");

ObjectName name = new ObjectName("jboss.jca:service=DataSourceBinding,*");

Set s = mconn.queryMBeans(name, null);

JBOSS AS 7 Users

You can get the list of the available datasources by navigating into the datasource subsystem using the CLI:


[standalone@localhost:9999 /] /subsystem=datasources:read-resource
{
    "outcome" => "success",
    "result" => {
        "xa-data-source" => undefined,
        "data-source" => {
            "ExampleDS" => undefined,
            "MySQLPool" => undefined
        },
        "jdbc-driver" => {
            "h2" => undefined,
            "mysql" => undefined
        }
    }
}

The same pattern applies for the newer WildFly application server.

Related articles available on mastertheboss.com

How to deploy a DataSource in jboss at application level ?

  Do you need to deploy your DataSource along with your Enterpri

JBoss Datasource HA

This tutorial has been updated for the new release of JBoss Appli

JBoss run out of Connections ?

Have you got No ManagedConnections available error message ? well

How to connect to a DataSource from a remote client?

  If you want to connect to your JBoss Connection Pool from a re

JBoss Datasource configuration

A Datasource is a Java Naming and Directory Interface (JNDI) obje

How to change JBoss Connection pool size dynamically ?

JBoss recipe of the day

Follow us on Twitter