Разработки / Настройка JDBC resource в JNDI Tomcat 6 on 07 March 2008 13:15
 <!-- Global JNDI resources -->
  <GlobalNamingResources>

    <!-- Test entry for demonstration purposes -->
    <Environment name=«simpleValue» type=«java.lang.Integer» value=«30»/>

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource name=«UserDatabase» auth=«Container»
              type=«org.apache.catalina.UserDatabase»
       description=«User database that can be updated and saved»
           factory=«org.apache.catalina.users.MemoryUserDatabaseFactory»
          pathname=«conf/tomcat-users.xml» />

    <Resource name=«jdbc/testDB» auth=«Container»
     type=«javax.sql.DataSource»
     driverClassName=«oracle.jdbc.OracleDriver»
     url=«jdbc:oracle:thin:@123.123.123.123:1521:testDB» 
     username=«db_user»
     password=«secret» maxActive=«20» maxIdle=«10» maxWait=«-1» />

  </GlobalNamingResources>
...
...
...
    <Engine>

      <Host>

      <Context docBase=«<TOMCAT_INSTALL_PATH>/webapps/WebApplication» 
path=«/WebApplication» reloadable=«true» 
source=«com.ibm.wtp.web.server:WebApplication»>
         <ResourceLink global=«jdbc/testDB» name=«testdatabase»
          type=«java.sql.DataSource» />

      </Context>

      </Host>

    </Engine>

  </Service>
Author: Макс

Tags: Tomcat, JNDI, resource, tomcat

Add comment
Rating: 2.97 / Rate 1 2 3 4 5

    Search: 
    Hello, Guest. ( Login / Create account )