title: How to configure JNDI Context in Axis2 under Tomcat 7?(JAX-WS web service that uses myBatis)
body: <p>I realized a Java web service that runs on Axis2 (Jax-WS) under Tomcat 7.
  To obtain data from postgreSQL this web service uses mybatis framework.
  All works fine if I manually set the connection parameters in mybatis-config.xml but
  I would like to use JNDI datasource to obtain them directly by the server context.</p>
  
  <p>In the myBatis-config.xml I put the following tag (inside the environment tag):</p>
  
  <pre><code>&lt;dataSource type="JNDI"&gt;
      &lt;property name="data_source" value="java:comp/env/jdbc/myWebService" /&gt;
  &lt;/dataSource&gt;
  </code></pre>
  
  <p>Searching on internet I also understood that I have to create a Tomcat (or Axis2 ?) Context whit the following tags:</p>
  
  <pre><code>&lt;Resource name="jdbc/myWebService" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/myDB" username="user" password="password" maxActive="20" maxIdle="10" maxWait="-1"/&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;resource-ref&gt;
      &lt;description&gt;ConnectionToPostgreSQL&lt;/description&gt;
      &lt;res-ref-name&gt;jdbc/myWebService&lt;/res-ref-name&gt;
      &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
      &lt;res-auth&gt;Container&lt;/res-auth&gt;
      &lt;res-sharing-scope&gt;Shareable&lt;/res-sharing-scope&gt;
  &lt;/resource-ref&gt;
  </code></pre>
  
  <p>But I don't know where (in which xml file) I have to put them and if anything else is needed.</p>