#175 Connect throgth a J2EE Datasource

Core (98)

I use Squirel with databases that normally are accessed
by my application in a J2EE Container using J2EE
Datasources. Pehraps Squirel should access J2EE
Datasources. The user give the namming URL, the namming
interface and the JNDI name of the datasource and
Squirel just connect to the datasource. Pehraps it
should be a plugin.


  • Andy Stevens

    Andy Stevens - 2011-09-30

    What container are you using?


  • Rob Manning

    Rob Manning - 2011-10-01

    I don't see how this could possibly work. A DataSource implementation is a Java object that lives in a J2EE/JEE container. Enterprise applications have access to a JNDI tree to lookup a DataSource in the *same* JVM that runs the Container. So, let's recap, the Enterprise application, the DataSource and the Container itself all run in the *same* JVM. So the Enterprise Application gets a reference to the DataSource using JNDI, and it invokes getConnection() to retrieve a Connection from the Connection pool that is managed by that DataSource in that *same* JVM. Along comes SQuirreL and it runs in a *different* JVM. It cannot access *any* of the objects in the Container's JVM unless they are serialized/deserialized into SQuirreL's JVM. Alright, but you cannot serialize a DataSource, because it contains Connections which cannot be serialized because they have network endpoints (sockets) attached to them. One JVM's sockets cannot be serialized/deserialized for use in another JVM. So there is no way for SQuirreL to get connections from a J2EE/JEE container's DataSource.



Log in to post a comment.