Tomcat6.0数据库连接池的配置
来源:互联网 发布:sqlserver时间戳转换 编辑:程序博客网 时间:2024/04/27 23:14
Tomcat Context.xml下配置:
<Resource name="jdbc/mysql"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/ycx"
username="root"
password="flf"
maxActive="100"
maxIdle="30"
maxWait="10000" />
app web.xml下配置:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/mysql</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
test.jsp
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<%@ page import="javax.naming.*"%>
<%@ page session="false" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<%
out.print(" my test begin !! ");
DataSource ds = null;
try{
InitialContext ctx=new InitialContext();
ds=(DataSource)ctx.lookup("java:comp/env/jdbc/mysql");
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
String strSql = " select * from admin";
ResultSet rs = stmt.executeQuery(strSql);
while(rs.next()){
rs.getString("admin_name");
out.print(rs.getString(1));
out.print(rs.getString("admin_name")+"/n");
}
out.print(" test is over");
}
catch(Exception ex){
out.print("ERROR:"+ex.getMessage());
ex.printStackTrace();
}
%>
</head>
<body>
</body>
</html>
- Tomcat6.0数据库连接池的配置
- tomcat6数据库连接池的配置
- Tomcat6数据库连接池的配置
- Tomcat6.0配置数据库连接池
- TomCat6.0数据库连接池配置
- TomCat6.0数据库连接池配置
- Tomcat6.0数据库连接池配置
- Tomcat6.0数据库连接池配置
- tomcat6数据库连接池配置
- tomcat6数据库连接池配置
- Tomcat6 数据库连接池配置
- Tomcat6数据库连接池配置
- tomcat6数据库连接池配置
- Tomcat6.0 连接池(与MySQL数据库连接)的配置
- 怎样配置Tomcat6.0的数据库连接池详解
- 怎样配置Tomcat6.0的数据库连接池详解
- tomcat6.0 + JSP + mysql数据库连接池配置
- tomcat6.0 + JSP + mysql数据库连接池配置
- c++标准库对正则表达式的支持
- MFC 与 HTTP编程
- 真机测试错误
- 如何使用istream_iterator将cin转到vector? (C/C++) (STL)
- 解决:ould not find a getter for porDate in class com.bc.bean.PortalSheet Caused by: org.hibernate.PropertyNotFoundException: Could
- Tomcat6.0数据库连接池的配置
- bat命令的书写
- 诚心求解
- Linux配置IP
- LC.EXE 已退出,代码为-1
- man文档
- 装饰器模式
- JDBC-数据库连接工具类
- 精确分析复杂的递推关系(n*logn*logn算法的由来)