Nice!

This works :)
Norman
> On 30. Mar 2017, at 17:27, Alan Bateman <alan.bate...@oracle.com> wrote:
> 
> On 30/03/2017 15:59, Norman Maurer wrote:
> 
>> Thats why I tried to kick-off the topic :) Thanks for the quick reply btw…. 
>> So is this list the right place for this discussion ?
>> 
> I just checked the docs for the JNDI-DNS provider [1] and it documents that 
> the provider updates the java.naming.provider.url property with the 
> configuration when it isn't initially specified. So I think this will do what 
> you want:
> 
> Hashtable<String, String> env = new Hashtable<>();
> env.put(Context.INITIAL_CONTEXT_FACTORY, 
> "com.sun.jndi.dns.DnsContextFactory");
> env.put("java.naming.provider.url", "dns://");
> DirContext ctx = new InitialDirContext(env);
> String dnsUrls = (String) 
> ctx.getEnvironment().get("java.naming.provider.url"));
> 
> -Alan
> 
> [1] http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-dns.html

Reply via email to