在Tomcat for Oracle中使用JNDI的分步指南

在Tomcat for Oracle中使用JNDI的分步指南,tomcat,jndi,Tomcat,Jndi,我有一个现有的基于spring框架的web应用程序。我想在Tomcat6和Oracle服务器上使用JNDI。请解释一个简单的步骤。请按照以下步骤操作: 在以下文件的标记中添加以下代码: apache-tomcat-6.0.37/conf/server.xml 确保 ojdbc14.jar 存在于文件夹中: apache-tomcat-6.0.37\lib 删除应用程序中以前定义的数据库连接参数(applicationContext.xml中定义的属性文件/数据源bean) 这应该足够了。这是

我有一个现有的基于spring框架的web应用程序。我想在Tomcat6和Oracle服务器上使用JNDI。请解释一个简单的步骤。请按照以下步骤操作:

  • 在以下文件的标记
    中添加以下代码:
  • apache-tomcat-6.0.37/conf/server.xml


  • 确保
  • ojdbc14.jar

    存在于文件夹中:

    apache-tomcat-6.0.37\lib


  • 删除应用程序中以前定义的数据库连接参数(applicationContext.xml中定义的属性文件/数据源bean)

  • 这应该足够了。

    这是一个伟大的知识, 您是否也可以分享如何为外部LDAP数据源配置JNDI

    在遵循您的步骤之后,数据库JNDI为我工作。 您可以在下面的链接中获得更多详细信息。

    谢谢
    Anny

    很抱歉,我不知道LDAP配置。不过,我会尝试找出答案。+1回答您的问题。然而,像JBoss和WAS这样的应用服务器为您提供了许多定制功能,例如DB连接池,这将真正使您的应用程序在重载应用程序中运行良好。
    <Resource name="jdbc/dbName" auth="Container" type="javax.sql.DataSource"
                       username="xyz" password="abcd"
                       url="jdbc:url"
                       driverClassName="oracle.jdbc.driver.OracleDriver"
                       initialSize="5" maxWait="5000"
                       maxActive="120" maxIdle="5"                   
                    poolPreparedStatements="true"/>
    
    <ResourceLink name="jdbc/dbName" global="jdbc/dbName" type="javax.sql.DataSource"/>
    
    <jee:jndi-lookup id="dataSource" jndi-name="jdbc/dbName" expected-type="javax.sql.DataSource" />
    
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx.xsd
    http://www.springframework.org/schema/jee
    http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://www.springframework.org/schema/beans