eclipse tomcat7.0配置sql server2014数据库连接池问题(JTDS)

来源:互联网 发布:淘宝小二在哪里找 编辑:程序博客网 时间:2024/06/06 04:28

由于工作原因,最近接手了一个老项目,原来的服务器是tomcat5.0连接的sql server,项目是放在tomcat的webapps文件下,不能调试,我把服务器换成了7.0,放在eclipse下用的jdk1.7,这样下来我就可以debug了,说的多了

下边教大家怎么配置,下图是eclipse的Servers文件,


1.找到E:\workspace\Servers\Tomcat v7.0 Server at localhost-config里面context.xml文件


2.给里面添加,(这里是参考)

<?xml version='1.0' encoding='utf-8'?><Context><Resource name="jdbc/sqlserver2005"auth="Container"type="javax.sql.DataSource"       username="sa"password="密码"    driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"    url="jdbc:sqlserver://localhost:1433;DatabaseName=blog"     maxActive="100" maxIdle="30" maxWait="5000"/>      <!-- Default set of monitored resources -->    <WatchedResource>WEB-INF/web.xml</WatchedResource></Context>
注意,下边是我具体的context.xml文件配置,

<?xml version="1.0" encoding="UTF-8"?><!--  Licensed to the Apache Software Foundation (ASF) under one or more  contributor license agreements.  See the NOTICE file distributed with  this work for additional information regarding copyright ownership.  The ASF licenses this file to You under the Apache License, Version 2.0  (the "License"); you may not use this file except in compliance with  the License.  You may obtain a copy of the License at      http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software  distributed under the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and  limitations under the License.--><!-- The contents of this file will be loaded for each web application --><Context><Resource name="java/workFlowDB"auth="Container"type="javax.sql.DataSource"username="sa"password="123456"    driverClassName="net.sourceforge.jtds.jdbc.Driver"url="jdbc:jtds:sqlserver://localhost:1433;DatabaseName=gxSafeAudit;instance=SQLEXPRESS"    maxActive="4" maxIdle="2" maxWait="5000"/> <Resource name="java/charismaDS"auth="Container"type="javax.sql.DataSource"username="sa"password="123456"    driverClassName="net.sourceforge.jtds.jdbc.Driver"url="jdbc:jtds:sqlserver://localhost:1433;DatabaseName=charisma_gxsh;instance=SQLEXPRESS"    maxActive="4" maxIdle="2" maxWait="5000"/>     <!-- Default set of monitored resources -->    <WatchedResource>WEB-INF/web.xml</WatchedResource>    <!-- Uncomment this to disable session persistence across Tomcat restarts -->    <!--    <Manager pathname="" />    -->    <!-- Uncomment this to enable Comet connection tacking (provides events         on session expiration as well as webapp lifecycle) -->    <!--    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />    --></Context>

再次特别感谢这个地址,http://www.cnblogs.com/canyangfeixue/archive/2012/12/26/2834496.html



原创粉丝点击