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

Reply via email to