newvirus
作者newvirus·2010-03-30 13:41
软件开发工程师·普天信息技术有限公司

TOMCAT 5.5 AND WEB应用配置JNDI

字数 1231阅读 1642评论 0赞 0
TOMCAT5.5下配置JNDI步骤:
STEP1:
          编辑 {$TOMCAT_INSTALL_PATH}CONFCONTEXT.XML
STEP2:
          插入  {<Resource name="jdbc/text" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@192.168.20.10:1521:rdoa" username="*****" password="****" maxActive="20" maxIdle="10" maxWait="10000"/>}
STEP3:
          编辑 WEB 应用程序下的 WEB-INFWEB.XML
STEP4:
          插入 {
   <resource-ref>
        <description>postgreSQL Datasource example</description>
        <res-ref-name>jdbc/text</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>
}
通过以上配置后再web应用通过以下代码访问:
Context ctx = new InitialContext();
DataSource ds=(DataSource) Context.lookup("java:comp/env/jdbc/text");

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

0

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广