How can we configure JNDI using tomcat server?
How can we configure JNDI using tomcat server similar to JBoss server using jboss-we开发者_StackOverflow中文版b.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
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>
Here's a JNDI HOWTO from Apache on how to configure JNDI on Tomcat 6.
- Related topic.
If you want a JNDI data source or something else, read the docs. They are quite detailed.
精彩评论