看了些资料,也没试出来.大致是说,tomcat5与tomcat4配置连接池方式有所不同. 在tomcat5中,为了能将不同连接可共用,把它分开到单独的与程序名同名的xml文件中. 文中还说,遇到楼主所说的(也是我遇到的)出错,是因为以下这个原因: 如果web应用没有配置对连接池的引用,即没有配置<ResourceLink>,则会在访问jsp页面时出现如下错误: NameNotFoundException: Name jdbc is not bound in this Context 但我照着做,还是没搞定:( 想到我这么聪明的人都没搞定,可见鬼佬这个东西也好用不到哪里去:) 具体见以下地址: http://www.gamvan.com/developer/java/2004/10/69.html
<!-- The contents of this file will be loaded for each web application --> <Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true"> <!-- Default set of monitored resources --> <WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts --> <!-- <Manager pathname="" /> -->
在tomcat5中,为了能将不同连接可共用,把它分开到单独的与程序名同名的xml文件中.
文中还说,遇到楼主所说的(也是我遇到的)出错,是因为以下这个原因:
如果web应用没有配置对连接池的引用,即没有配置<ResourceLink>,则会在访问jsp页面时出现如下错误:
NameNotFoundException: Name jdbc is not bound in this Context
但我照着做,还是没搞定:(
想到我这么聪明的人都没搞定,可见鬼佬这个东西也好用不到哪里去:)
具体见以下地址: http://www.gamvan.com/developer/java/2004/10/69.html
希望對你有幫助!
http://blog.csdn.net/TomyGuan/services/trackbacks/436875.aspx
在网上找资料,也请教了同事,配了好久,也没成功.
后来用google去查英文资料,偏偏在台湾网站上找到.功夫不负有心人啊,仅仅这样做就可以了:
在{$TOMCAT_HOME}conf/context.xml文件中写入以下信息:
<!-- The contents of this file will be loaded for each web application -->
<Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true">
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<Resource name="jdbc/OracleDB" auth="Container" type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@192.168.0.92:1521:mydb"
username="yourname" password="yourpass"
maxActive="20" maxIdle="10" maxWait="-1" />
</Context>注意其它文件可不必修改,具体请参考:
http://www.javaworld.com.tw/jute/post/view?bid=9&id=105278&sty=1&tpg=1&age=0
我的MSN: [email protected]