Search code examples
javadatabaseglassfishconnection-poolingexternal

How to connect to a database configured in glassfish from an external java application?


The title pretty much says it all, but here's some background.

We have a database configured in glassfish accessed by a website deployed on glassfish, we also access the database from an external java application, it occurred to me that this could be somewhat inefficient since we open quite a few connections to the database from our external app. So I was wondering if we could somehow access he database through glassfish's connection pool?

Thanks in advance.

Piers


Solution

  • You'll have to try this.

    http://javahowto.blogspot.com/2006/08/access-glassfish-datasource-remotely.html suggests it is possible to look up the connection pool via JNDI from a standalone client. An actual client code example is given at http://javahowto.blogspot.com/2006/08/access-jboss-datasource-remotely-from.html#client