tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Dunwoody <james.dunwo...@sytec.co.nz>
Subject RE: JNDI lookup from console app
Date Mon, 15 Sep 2003 09:47:36 GMT
Thanks Anton,

My question was brought about because of my experience with Weblogic and
other app servers, where as you describe, a remote lookup is possible of an
EJB. I extrapolated this to include datasources...

I was guessing that some form of client library might be required in order
to facilitate this (like a EJB stub etc).
I was also guessing that once the DataSource was found, the database
protocol would then be used to send the JDBC commands.

My reason for investigating whether a Tomcat-managed DataSource could be
used externally to Tomcat was to get the benefits of having the DataSource
centrally managed (in Tomcat) and available to the web app as well as
allowing me to write a simple test client that could use this DataSource
without needing to run within the container.

I am using DBCP and have a driver-version of my test case completed with a
local configuration. I was just interested to see if I could generalise and
possibly create a better solution by using DataSources.

Thanks again Anton.

James

-----Original Message-----
From: Anton Tagunov [mailto:atagunov@mail.cnt.ru]
Sent: Monday, 15 September 2003 9:21 p.m.
To: Tomcat Users List
Subject: Re: JNDI lookup from console app


Hello James!

JD> I'm trying to lookup a DataSource using JNDI configured within Tomcat
(I'm
JD> not using JBoss) from an application that isn't in the container (i.e. a
JD> console app). 

JD> 1. Is Tomcat's JNDI available to application outside of the container?
No they are not.
BTW, how you would imagine it would work?
What sort of communication would be stablished between the console
app and Tomcat? Tomcat serves only HTTP requests and requests from
connectors like mod_jk to plug Tomcat into things like Apache and IIS.
Nothing else. How would JNDI work? Imagine you would get something
for the JNDI node the datasrouce is configured at. Now, how will you
communicate to the datasource? The datasource lives inside Tomcat JVM,
your application runs in another. How would you invoke methods across
JVM? Via RMI or Corba? But then the datasource implementation should
have been running as an RMI or Corba object which it does not.
The JNDI run by Tomcat is for Tomcat inhabitants like JSP-s and
servlets only.

BTW, datasource implementations are not regularly remoted in any
scenario. If you're running a EJB server like JBoss, or Jonas, then
it has datasources configured internally for the use of EJB-s that
it hosts, but only the EJB-s themselves, not the datasources they
use are accessible remotely.

If you need datasource functionality in your console application
create and configure it manually there. Most likely your JDBC
driver has a Datasource implementation bundled in, instantiate
it directly. Or just use DriverManager.getConnection().
If you need pooling use BasicDataSource from jakarta-commons/dbcp
manually on top of your db vendor provided datasource or
DriverManager-compatible driver.


Anton


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

Mime
View raw message