users@glassfish.java.net

Dynamic DB connections

From: <glassfish_at_javadesktop.org>
Date: Thu, 10 Jun 2010 04:31:34 PDT

Advice from the community required please on the best way to achieve the following:

I'm designing an EJB3 + Stateful Session Bean based system which will need to utilise XA transactions across multiple databases server side. The system will be executing a script supplied by a client where one or more databases (and hence connections) will be utilised. For a single connection, this will be via a standard JNDI lookup into the JDBC driven connection pools. The catch I have is that further database connections required by the script may be to databases defined via a URL, including user and password details.

So, without having to pre-configure all possibly required database connections in Glassfish, what's the best way to:
1. Create a new database connection mid XA transaction on the fly
2. Have that new dynamic connection participate within the XA transaction
3. Ensure any dynamic connections get tidied down

I need to target App Servers other than Glassfish (assuming EJB3 support etc.), so any proposed solution would need to be JEE "standard". From forum searches, this type of requirement doesn't seem to fit will with the JEE model.

Any pointers or tips greatly appreciated.
[Message sent by forum member 'andrew_hastie']

http://forums.java.net/jive/thread.jspa?messageID=473721