Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Database/JDBC/SQL/JDO/Hibernate
打印话题 寄给朋友 订阅主题 |
作者 | Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re:xlwh123] |
im_is
发贴: 2 积分: 0 |
于 2005-05-15 14:23
问一下,Tomcat5.5中的数据源和连接池配置的XML格式是不是和Tomcat5.0以前的版本不一样了,看很多人介绍数据原配置是这样的: <Context path="/test" docBase="test" debug="0" reloadable="true" crossContext="true"> <Resource name="jdbc/connectDB" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/connectDB"> <parameter> <name>maxActive</name> <!-- Maximum number of DB connections in pool.Set to 0 for no limit. --> <value>100</value> </parameter> <parameter> <name>maxIdle</name> <!-- Maximum number of idle DB connections to retain in pool.Set to 0 for no limit. --> <value>30</value> </parameter> <parameter> <name>maxWait</name> <!-- Maximum time to wait for a DB connection to become available in ms.An exception is thrown if this timeout is exceeded.Set to -1 to wait indefinitely. --> <value>10000</value> </parameter> <parameter> <name>removeAbandoned</name> <!-- Abandoned DB connections are removed and recycled --> <value>true</value> </parameter> <parameter> <name>removeAbandonedTimeout</name> <!-- Use the removeAbandonedTimeout parameter to set the number of seconds a DB connection has been idle before it is considered abandoned. --> <value>60</value> </parameter> <parameter> <name>logAbandoned</name> <!-- Log a stack trace of the code which abandoned --> <value>false</value> </parameter> <parameter> <name>factory</name> <!-DBCP Basic Datasource Factory --> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>username</name> <!-- Database User Name --> <value>root</value> </parameter> <parameter> <name>password</name> <!-- User Password --> <value></value> </parameter> <parameter> <name>driverClassName</name> <!-- Database Driver Class Name --> <value>com.mysql.jdbc.Driver</value> </parameter> <parameter> <name>url</name> <!-- Database Address --> <value>jdbc:mysql://localhost/test</value> </parameter> </ResourceParams> </Context> 今天按这个方法在Tomcat5.5中配置的一上午老是不行。后来看了Tomcat5.5的文档,按如下配置: <Context path="/test" docBase="test" debug="0" reloadable="true" crossContext="true"> <Resource name="jdbc/connectionDB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="root" password="root" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/test?autoReconnect=true"/> </Context> 是不是Tomcat5.5一定要用后面这种配置了? 如何用JTable设置表头多行 |
话题树型展开 |
已读帖子 新的帖子 被删除的帖子 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |