1.设置数据源
apache-tomcat-6.0.29\conf\context.xml
<?xml version='1.0' encoding='utf-8'?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Resource url="jdbc:oracle:thin:@192.168.0.5:1521:test" driverClassName="oracle.jdbc.OracleDriver" password="username" username="password" logAbandoned="true" maxWait="10000" maxIdle="30" maxActive="50" type="javax.sql.DataSource" auth="Container" name="jdbc/test" testOnBorrow="true" validationQuery="select 1 from dual" />
</Context>
2.修改war包中的web.xml
myApp\WEB-INF\web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
... ...
<resource-ref>
<description>test</description>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
3.修改war包中引用数据源的方式
在WAS中使用,配置成jdbc/test即可,在tomcat中需要修改为java:comp/env/jdbc/test
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/test"></property>
</bean>
... ...
<beans>
4.添加驱动
apache-tomcat-6.0.29\lib\ojdbc14-10.2.0.3.0.jar
分享到:
相关推荐
apache-tomcat-6.0.29.zip
mss-1.4.0.FINAL-apache-tomcat-6.0.29 此为28181新版调测软件,按照 连接说明(在压缩包里面)来安装解包就可以调试了
SPVMN 视频监控联网调测软件完整版(mss-1.4.0.FINAL-apache-tomcat-6.0.29) SPVMN 视频监控联网调测软件完整版(mss-1.4.0.FINAL-apache-tomcat-6.0.29)
解压版--apache-tomcat-6.0.29.zip--无需安装
apache-tomcat-6.0.29 标准
apache-tomcat-6.0.29.tar.gz亲测可用
apache-tomcat-6.0.29.rar apache-tomcat-6.0.29.rar
apache-tomcat-6.0.29.tarapache-tomcat-6.0.29.tar
用于GB28181信令调测,SIP调测工具,级联调测,组织结构调测,视频流调测,非常方便,亲测可用,使用前请安装JAVA1.6。
tomcat 6.0 服务器软件,用于 JSP ,J2EE,
JavaWeb编程首选服务器 加压即可导入项目使用 绿色免安装实用好用,共享给大家
apache-tomcat-6.0.29-src.tar
apache-tomcat-6.0.29 源码+运行包 天涯浪子