P.S. here you go: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html
Enjoy! :) Geeta > -----Original Message----- > From: Koon Yue Lam [mailto:[EMAIL PROTECTED] > Sent: Monday, July 19, 2004 12:46 PM > To: Struts Users Mailing List > Subject: Datasource problem again.. > > > Hi ! > I have try the follow to retrieve a datasource from Struts using JNDI: > > Context initCtx = new InitialContext(); > Context envCtx = (Context) initCtx.lookup("java:comp/env"); > DataSource ds = (DataSource) envCtx.lookup("jdbc/kiss_web_news"); > > but it doesn't work.... > > it is my struts-config,xml: > <data-sources> > <data-source type="org.apache.commons.dbcp.BasicDataSource"> > <set-property > property="driverClassName" > value="org.gjt.mm.mysql.Driver" /> > <set-property > property="url" > value="jdbc:mysql://localhost/kiss_web_news" /> > <set-property > property="username" > value="root" /> > <set-property > property="password" > value="1234567" /> > </data-source> > </data-sources> > > Do I need to modify the web.xml under $Tomcat/conf ?? It seems that > Stucts doesn't registry the datasource to JNDI and I always get a null > pointer of datasource. > > any help? > > Regards > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]