Hello Thanks for the info Fabio! I will be using WebSphere version 4 and it has a connection pool setup in the server admin pages. I have yet to test my code under but I have set it up (db conn pool) and it seems quit easy. I should be able to use my data access code (which is pretty much the same as your example). BTW, which version of WS are you using?
Thanks and sorry for being OT!! D Watson ----- Original Message ----- From: "Fabio Mengue" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Tuesday, May 21, 2002 8:23 AM Subject: Re: Connection Pool Configuration > Hi, > > I have the same problem. Want connection pool to work on Tomcat and Websphere > without to rewrite code. IBM send us instructions to set up the server and a > piece of code that looks like this: > > ... > java.util.Properties parms = new java.util.Properties(); > parms.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, > "com.ibm.websphere.naming.WsnInitialContextFactory"); > javax.naming.Context ctx = new > javax.naming.InitialContext(parms); > javax.sql.DataSource ds = > (javax.sql.DataSource)ctx.lookup("jdbc/db2proddb02DS"); > java.sql.Connection c = ds.getConnection(user,pass); > ... > > It works on Websphere, but as you can see, initial conext is provided by > Websphere code, and I won't use that in Tomcat (in fact I think this is EJB > code, and Tomcat does not support it; I can't use it even if I want to). > > So I'm trying an alternate path: > > ... > javax.naming.Context ctx = new javax.naming.InitialContext(); > javax.sql.DataSource ds = > (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/db2proddb02DS"); > java.sql.Connection c = ds.getConnection(user,pass); > ... > > And on /conf/server.xml > > <!-- MyApp Context --> > <Context path="/myapp" docBase="myapp" debug="0" > reloadable="true" crossContext="true"> > > <!-- Pool de Conexao DB2 --> > <Resource name="jdbc/db2proddb02DS" auth="SERVLET" > type="javax.sql.DataSource"/> > <ResourceParams name="jdbc/db2proddb02DS"> > <parameter><name>user</name><value></value></parameter> > <parameter><name>password</name><value></value></parameter> > <parameter><name>driverClassName</name> > > <value>COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource</value></parameter> > <parameter><name>driverName</name> > <value>jdbc:db2:database</value></parameter> > </ResourceParams> > </Context> > > I'm still getting a "Null Pointer" error, but I think that when I got it to > work, I might use the very same configuration (and code) on both servers, since > COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource it's not Websphere code. > > Hope it helps. And note that I may be wrong :) Perhaps one of the fine people in > this list may correct me. > > Fabio. > > > -- > Fabio Mengue - Centro de Computacao - Unicamp > [EMAIL PROTECTED] [EMAIL PROTECTED] > "Quem se mata de trabalhar merece mesmo morrer." - Millor -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>