You cannot lookup a datasource remotely, it is only visible to the components within app server.
to all appearances your I can't confirm your answer. Instead its the main-advantage to look local for your remote database, even if you have access to the jndi-context. Or did you mean something else?
If you application is running in a different JVM to JBoss you will not be able to access the data connection registered in the JBoss JNDI.
By doing props.put(InitialContext.PROVIDER_URL, "jnp://localhost:1099");
you are effectively accessing JNDI from the outside regardless of where your code is being exeuted.