You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by hemant <xr...@yahoo.com> on 2002/03/01 23:50:33 UTC
JNDI Lookup, Websphere Vs Tomcat
Here is how we proceed for a DataSource JNDI Lookup with WebSphere
//-----------------------------
...........
java.util.Properties parms = new java.util.Properties();
parms.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
// Create the Initial Naming Context
javax.naming.Context ctx = new javax.naming.InitialContext(parms);
// Lookup through the naming service to retrieve a DataSource object
javax.sql.DataSource ds =
(javax.sql.DataSource)ctx.lookup("jdbc/SampleDB");
// Obtain a Connection from the DataSource
java.sql.Connection conn = ds.getConnection();
............
//-----------------------------
Datasources could thus be parked on WebSphere and accessed by clients remotely.
1>> Now, Can we park Datasources on Tomcat in a similar manner? Does Tomcat provide DataSources to WebApps only?.
2>> If we can create DataSources on Tomcat to be remotely available (clients could be EJB's on another server ) How do we go about doing that?
Thank You for your time
Regards
hemant
Re: JNDI Lookup, Websphere Vs Tomcat
Posted by Eddie Bush <ek...@swbell.net>.
I'm not sure how to do it, but I bet you could find the answer on the tomcat
site.
http://jakarta.apache.org/tomcat/index.html
I believe they have a users' mailing list too =)
----- Original Message -----
From: "hemant" <xr...@yahoo.com>
To: "struts" <st...@jakarta.apache.org>
Sent: Friday, March 01, 2002 4:50 PM
Subject: JNDI Lookup, Websphere Vs Tomcat
Here is how we proceed for a DataSource JNDI Lookup with WebSphere
//-----------------------------
...........
java.util.Properties parms = new java.util.Properties();
parms.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
// Create the Initial Naming Context
javax.naming.Context ctx = new javax.naming.InitialContext(parms);
// Lookup through the naming service to retrieve a DataSource object
javax.sql.DataSource ds =
(javax.sql.DataSource)ctx.lookup("jdbc/SampleDB");
// Obtain a Connection from the DataSource
java.sql.Connection conn = ds.getConnection();
............
//-----------------------------
Datasources could thus be parked on WebSphere and accessed by clients
remotely.
1>> Now, Can we park Datasources on Tomcat in a similar manner? Does Tomcat
provide DataSources to WebApps only?.
2>> If we can create DataSources on Tomcat to be remotely available (clients
could be EJB's on another server ) How do we go about doing that?
Thank You for your time
Regards
hemant
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>