I have a Java project that runs from the command line. It is using Spring. At the current time my project is mySQL. Use can see from the config.xml below
Found this searching the web for "jboss external jndi"
http://www.engfers.com/2008/08/07/exposing_accessing-jboss-jndi-objects_datasources-from-an-external-jvm/
Looks like what you're after. It's amazing what you can find with your favorite search engine ;)