JNDI is provides only a way to lookup local and remote objects. RMI is used to invoke the remote methods
So in theory you can bind a datasource in one VM (Tomcat) and do a lookup in your application VM and do a getConnection using RMI.
But this has approach has a problem. You cannot transfer an open connection from one VM to another (neither a database connection nor a simple socket).
Your solution of simply opening one database connection for each application VM is probably the best/easiest way (the number of application VMs will be your first limit and not the number of database connections).
A more advanced solution is to separate you business and presentation code (that’s always a good practice). Use a kind of business facade (service interface) and data transfer objects (value objects).
If you have this design then you can deploy your business methods (and/or data access objects) on tomcat and access those from your presentation/application VM using SOAP.
I can recommend axis (http://ws.apache.org/axis/). I’m using it myself to connect from a swing application to a remote server. If you have a service interface and value objects then axis does most of the SOAP work.
You can use RMI or AltRMI (http://incubator.apache.org/projects/altrmi/) to do the communication as well.
-- Dirk
Benoit Marchal wrote:
To be more specific about what we are trying to do, we are using
Webcream to make our java application web enable (see www.creamtec.com).
Webcream is working well but we had to make the rendering job done in a
separate JVM that communicate with Tomcat through RMI (I don't have
access to that communication channel). Basically each client that
connect to our Web enabled java application will induce the creation of
a separate JVM. The problem is that we need to make connection with the
db from within the separate JVMs. Defining a new pool for each JVM is
not an option (too many connection opened then) and in that case using
no connection pool at all is even better.
I have tried to communicate with the Tomcat DBCP through JNDI but I
haven't been successful so far (I am not an expert in JNDI anyway)
Benoit
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
