Reputation: 61
How can we configure JNDI using tomcat server similar to JBoss server using jboss-web.xml? Please help me on this?
I want to know which file we need to write it? or is there any programmatic way to do this?
Thanks in Advance, Pravin
Upvotes: 6
Views: 9777
Reputation: 89169
Here's a JNDI HOWTO from Apache on how to configure JNDI on Tomcat 6.
Upvotes: 1
Reputation: 1475
Write a context.xml
<Context>
<Resource name="jdbc/dbConnection"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="j<url to database>"
username="user"
password="pwdt"
validationQuery="select 1"
removeAbandoned="true"
removeAbandonedTimeout="120"
maxWait="60"
maxActive="20"
maxIdle="10" />
</Context>
Upvotes: 12