Topic: 求助:struts-config中如何配置数据源 |
Print this page |
1.求助:struts-config中如何配置数据源 | Copy to clipboard |
Posted by: shokey520 Posted on: 2005-09-24 02:51 目前小弟正在学习struts。但一直不能解决连接到MS SQL Server的问题。在网上查看资料配置如下: <data-sources> <data-source key="sqlserver" type="org.apache.commons.dbcp.BasicDataSource"> <set-property property="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver" /> <set-property property="url" value="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=struts"/> <set-property property="maxActive" value="5" /> <set-property property="username" value="sa" /> <set-property property="password" value="" /> <set-property property="autoCommit" value="true" /> </data-source> </data-sources> 但是在正常的登录页面显示后,一点提交按钮就会报Servlet actionServlet is not available错误。很是郁闷。CLASSPATH设置过了,JDBC的三个JAR文件也拷贝到了TOMCAT相应的lib目录下了。去除<data-source>的配置,程序又正常。请高手指点指点。 |
2.Re:求助:struts-config中如何配置数据源 [Re: shokey520] | Copy to clipboard |
Posted by: why Posted on: 2005-09-24 03:06 Which version of Struts are you using? And Tomcat's? You may need certain legacy.jar if you are using Struts 1.1.x. What are the error/log messages? I'm wondering whether this data-sources section will be deprecated in next release of Struts. Let's check ... http://struts.apache.org/faqs/database.html The DataSource manager is being retained in Struts 1.x for backward compatibility but may not be retained in Struts 2.x or later. |
3.Re:求助:struts-config中如何配置数据源 [Re: shokey520] | Copy to clipboard |
Posted by: shokey520 Posted on: 2005-09-24 03:22 Thanks for your reply. The version of struts I use is 1.2.4 and the Tomcat is 5.0.25 |
4.Re:求助:struts-config中如何配置数据源 [Re: shokey520] | Copy to clipboard |
Posted by: eter Posted on: 2005-11-23 11:04 <data-sources> <data-source key="eplan" type="org.apache.commons.dbcp.BasicDataSource"> <set-property property="autoCommit" value="false" /> <set-property property="description" value="Database for MyCMS of System" /> <set-property property="driverClassName" value="org.gjt.mm.mysql.Driver" /> <set-property property="maxWait" value="100" /> <set-property property="maxIdle" value="10" /> <set-property property="maxActive" value="20" /> <set-property property="url" value="jdbc:mysql://localhost:3306/eplan" /> <set-property property="username" value="root" /> <set-property property="password" value="yourpassword" /> </data-source> </data-sources> |
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 |