Christopher & Pid-2: I actually have something working although I'm not entirely sure I have a complete understanding; there are still some gaps. I found this article --> http://wiki.apache.org/tomcat/UsingDataSources and it helped a great deal.
Here is what I have done: Step 1 - Using Tomcat's admin console I defined the data source which yielded the following server.xml <?xml version="1.0" encoding="UTF-8"?> <Server> <Listener className="org.apache.catalina.core.AprLifecycleListener"/> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/> <GlobalNamingResources> <Environment name="simpleValue" type="java.lang.Integer" value="30"/> <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase" pathname="conf/tomcat-users.xml" factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/> <Resource name="jdbc/USER" type="javax.sql.DataSource" driverClassName="COM.ibm.db2.jdbc.app.DB2Driver" password="ecomm1" maxIdle="2" maxWait="5000" username="ecomm1" url="jdbc:db2:USER" maxActive="4"/> </GlobalNamingResources> <Service name="Catalina"> <Connector port="8080" redirectPort="8443" minSpareThreads="25" connectionTimeout="20000" maxThreads="150" maxSpareThreads="75"> </Connector> <Connector port="8009" redirectPort="8443" protocol="AJP/1.3"> </Connector> <Engine defaultHost="localhost" name="Catalina"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/> <Host appBase="webapps" name="localhost"> </Host> </Engine> </Service> </Server> Step 2 - Defined the context.xml as part of the web application (described in the tutorial mentioned above). <?xml version="1.0" encoding="UTF-8"?> <Context> <Resource name="jdbc/USER" auth="Container" type="javax.sql.DataSource" username="xxx" password="xxx" driverClassName="COM.ibm.db2.jdbc.app.DB2Driver" url="jdbc:db2:USER" maxActive="8" /> </Context> Step 3 - Connect to the DB I used the datasource name "java:comp/env/jdbc/USER" for the connection and this worked fine. So, this process worked and what I'm looking to do next is to figure out a way where I can remove the dependency on the context.xml residing in the web application. According to what I understand from reading the documentation this should be possible by placing the context.xml entries in the context.xml file that resides in Tomcat's "conf" directory. The other interesting point will be to see if I can remove the user id and password from the context.xml entry. We need to externalize those for security purposes. So, the best place is to configure them in DB2's configuration manager. Also, the pieces that I don't quite have a handle on is the actual look up references (linkages) between all of the moving parts. That is to say JNDI->datasource definition. Fran Fran Varin wrote: > > Hi, > > We are in the process of trying to use Tomcat 5.5.20 to access an existing > DB2 Database. Up until this point the application has been running under > WebSphere (We are trying to utilize Tomcat for testing purposes). In > WebSphere we can supply an IBM JNDI Factory Class named > "com.ibm.websphere.naming.WsnInitialContextFactory" as the > "Context.INITIAL_CONTEXT_FACTORY". We can then find our driver and all is > well. > > Clearly, in Tomcat the above mentioned class does not exist. I've been all > over the place trying to find an equivalent class that is part of Tomcat. > It boils down to my attempt at using > "org.apache.naming.java.javaURLContextFactory". However, when I do I > receive "javax.naming.NameNotFoundException: Name jdbc is not bound in > this Context:". > > I need to resolve this issue in order to move forward with using Tomcat > but, cannot seem to find a good example that explains how to do this. I've > seen the documents that loosely describe change server.xml and creating a > context.xml for the application. But, this seems like the wrong path given > the way that we have always proceeded with creating DB connections. So, it > has really just added to my confusion. > > Any help would be greatly appreciated, > > Fran > > -- View this message in context: http://www.nabble.com/Context.INITIAL_CONTEXT_FACTORY-tf3155036.html#a8770961 Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]