Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we configure JNDI using tomcat server?

Tags:

java

tomcat

jndi

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

like image 857
Pravin Pawade Avatar asked Nov 07 '10 11:11

Pravin Pawade


1 Answers

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>
like image 80
lalit Avatar answered Sep 27 '22 23:09

lalit