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]