title: Custom resource in JNDI on different application servers
body: <p>Preface:<br>
  Most of J2EE applications are using container managed datasources through JNDI. This is fine as it gives one place for configuring these connections.<br>
  The problem arises when we want to use ORM framework (like hibernate) or something that have to know the default schema (mostly for Oracle, may be others too), which can be different from the username that is used to connect to the DB.</p>
  
  <p>I want to put the default schema name somewhere close to the datasource definition. One of the options would be to put it in JNDI. I will then manually read of from there before construction the EntityManager (well actually using Spring).</p>
  
  <p>As I found out there is a simple way to specify custom resource (in this situation it will be String with default schema name) in Apache Tomcat like this (correct me if I'm wrong):</p>
  
  <pre><code>&lt;Environment name="schemaNames/EmployeeDB"
               type="java.lang.String"
              value="empl"
        description="Schema name of Employees Database for HR Applications"/&gt;
  </code></pre>
  
  <p>Anyway, considering this can be done in Apache Tomcat, how should I configure the same custom JNDI resource (of String type) within other application servers:</p>
  
  <ul>
  <li>JBoss 4/5</li>
  <li>WebSphere 6/7</li>
  <li>WebLogic 9/10</li>
  </ul>
  
  <p>If you know about other servers that would be great too.</p>
  
  <p>Also, as an alternative I don't want to put the schema name in system properties or environment variables.</p>
  
  <p>Thank you very much !</p>
  
  <hr/>
  
  <p><strong>Update:</strong><br>
  Found some way of achieving it on JBoss. I didn't test it tho.<br>
  <a href="http://forums.java.net/jive/thread.jspa?messageID=316228" rel="nofollow noreferrer">http://forums.java.net/jive/thread.jspa?messageID=316228</a></p>
  
  <p>Found information for WebLogic, but they talk about doing it programmaticly and not with configuration:<br>
  <a href="http://weblogic-wonders.com/weblogic/2010/06/12/binding-objects-in-weblogic-servers-jndi-tree/" rel="nofollow noreferrer">http://weblogic-wonders.com/weblogic/2010/06/12/binding-objects-in-weblogic-servers-jndi-tree/</a><br>
  <a href="http://forums.oracle.com/forums/thread.jspa?messageID=4397353" rel="nofollow noreferrer">http://forums.oracle.com/forums/thread.jspa?messageID=4397353</a></p>