I assume you are not using "jdbc-connection-pool" in GlassFish.
Did you execute your standalone java program in the same machine where GlassFish is running ?
Can you post the code snippet that is setting connection parameters and establishing the connection ?
[Message sent by forum member 'jr158900']
http://forums.java.net/jive/thread.jspa?messageID=392543