Is there any issue with It. Does this should work or should not work?? Is there any issue with connection object created using below code??
I implemented even putting context.xml file in <tomcat>/conf and I was able to get is work successfully.Bze we are looking for a JNDI default implementation which should be available for all WAR file in <tomcat>/webapps Thanks and Regards On 5/21/08, Mark Thomas <[EMAIL PROTECTED]> wrote: > > Hanmay Udgiri wrote: > >> Yes this is working >> I am able to get connection pool object... >> > > And the database connection works? That surprises me. > > Mark > > >> On 5/21/08, Mark Thomas <[EMAIL PROTECTED]> wrote: >> >>> Hanmay Udgiri wrote: >>> >>> Hi >>>> I am currently using connection pooling in tomcat. >>>> The code is as below >>>> I have a context.xml.default placed in <Tomcat install >>>> directory>/conf/[enginename]/[hostname]/ file which has below code. >>>> <Context> >>>> <Resource >>>> name="jdbc/mylogger" >>>> auth="Container" >>>> factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" >>>> type="javax.sql.DataSource" >>>> removeAbandoned="true" >>>> maxActive="20" >>>> maxIdle="10" >>>> maxWait="-1" >>>> removeAbandonedTimeout="60" /> >>>> </Context> >>>> >>>> Where as in Java code i am setting the values of Userd,pwd driverclass >>>> and >>>> URL. >>>> *My question here is Is there any effect,If I am not specifying the >>>> these >>>> values in context.xml.default???* >>>> >>>> Context initContext = new InitialContext(); >>>> Context envContext = (Context) initContext.lookup("java:comp/env"); >>>> DataSource ds = (DataSource) envContext.lookup("jdbc/mylogger"); >>>> ((org.apache.tomcat.dbcp.dbcp.BasicDataSource) ds).setUsername(sUserID); >>>> ((org.apache.tomcat.dbcp.dbcp.BasicDataSource) >>>> ds).setPassword(sPassword); >>>> ((org.apache.tomcat.dbcp.dbcp.BasicDataSource) >>>> ds).setDriverClassName(jdbcDriverClass); >>>> ((org.apache.tomcat.dbcp.dbcp.BasicDataSource) >>>> ds).setUrl(jdbcDriverConnectURL + dbServiceName); >>>> dbConnection = ds.getConnection(); >>>> >>>> Does this work? Do you get nay errors in the logs? >>> >>> Mark >>> >>> --------------------------------------------------------------------- >>> To start a new topic, e-mail: users@tomcat.apache.org >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >> >> > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Thanks and Regards Hanmayya Udgiri