---
title: "Tomcat下设置jndi数据源"
author: "up2pu"
date: "2011-08-12T09:44:26Z"
tags: ["Apache", "JDBC", "Java", "Tomcat"]
categories: ["开源软件"]
slug: "tomcat-jndi"
draft: false
lastmod: "2011-08-12T09:52:14Z"
id: 1147030
url: "https://up2pu.iteye.com/blog/1147030"
---

1.添加文件 apache-tomcat-6.0.20\\conf\\context.xml \[code="xml"] WEB-INF/web.xml \[/code] 2.参数说明 maxIdle：最大空闲数，数据库连接的最大空闲时间。超过空闲时间，数据库连接将被标记为不可用，然后被释放。设为0表示无限制。 maxActive：连接池的最大数据库连接数。设为0表示无限制。 maxWait：最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。 3.参考文档 \[url]http://localhost:8080/docs/jndi-datasource-examples-howto.html\[/url]