Re: List available data sources in EJB

From: Alex Molochnikov (NOBODY_at_NOSPAM.COM)
Date: 03/10/05


Date: Thu, 10 Mar 2005 03:03:40 GMT

Responding to my own post:

It is possible. Here is the code:

InitialContext context = new InitialContext();
NamingEnumeration ne = context.listBindings("java:/");
while (ne.hasMore())
{
    Binding b = (Binding) ne.next();
    if (b.getClassName().endsWith(".DataSource"))
        System.out.println(" data source = " + b.getName());
}