title: How to configure a global JNDI datasource in Tomcat 6?
body: <p>I'm struggling to configure a simple JNDI pooled datasource in Tomcat 6.0.32.</p>
  
  <p>I want to create the datasource definition outside my web application artifact. Basically I don't want my application to know the credentials to access the database server.
  I was under the assumption that, like in Weblogic, it should be possible to create a "global" JNDI datasource in Tomcat, but so far I have been unsuccessful.</p>
  
  <p>I have tried to add the datasource definition in CATALINA_HOME/conf/context:</p>
  
  <pre><code>&lt;Resource name="jdbc/mydb"
   auth="Container"
   type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
   factory="oracle.jdbc.pool.OracleDataSourceFactory"
   url="jdbc:oracle:thin:@1.1.1.1.:xxx"
   user="xxxx"
   password="yyyy"/&gt;
  </code></pre>
  
  <p>The result is that the server outputs the following line, when booting:</p>
  
  <pre><code>SEVERE: Null component Catalina:type=DataSource,path=/,host=localhost,class=javax.sql.DataSource,name="jdbc/mydb"
  </code></pre>
  
  <p>Any pointer would be appreciated.</p>