佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 719|回复: 3

strut 连接不到 SQL SERVER

[复制链接]
发表于 2-3-2006 11:17 PM | 显示全部楼层 |阅读模式
strut 连接不到 SQL SERVER

error message

  1. java.net.UnknownHostException: localhost
  2.         at java.net.InetAddress.getLocalHost(Unknown Source)
  3.         at com.inet.tds.TdsDriver.run(Unknown Source)
  4.         at java.lang.Thread.run(Unknown Source)
  5. DBCP borrowObject failed: com.inet.tds.SQLException: java.net.UnknownHostException: yzme\yzme
  6. org.apache.commons.dbcp.DbcpException: com.inet.tds.SQLException: java.net.UnknownHostException: localhost
  7.         at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:85)
  8.         at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:184)
  9.         at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source)
  10.         at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:117)
  11.         at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110)
  12.         at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
  13.         at org.apache.struts.util.GenericDataSource.getConnection(GenericDataSource.java:276)
  14.         at tess.caa.caaCommAction.execute(caaCommAction.java:39)
  15.         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
  16.         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
  17.         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
  18.         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
  19.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
  20.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  21.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
  22.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
  23.         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
  24.         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  25.         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  26.         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  27.         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
  28.         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  29.         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  30.         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  31.         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
  32.         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
  33.         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  34.         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
  35.         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
  36.         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
  37.         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
  38.         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  39.         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  40.         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
  41.         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  42.         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  43.         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  44.         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
  45.         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
  46.         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
  47.         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
  48.         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
  49.         at java.lang.Thread.run(Unknown Source)
  50. Caused by: com.inet.tds.SQLException: java.net.UnknownHostException: localhost
  51.         at com.inet.tds.TdsDriver.a(Unknown Source)
  52.         at com.inet.tds.TdsDriver.connect(Unknown Source)
  53.         at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:83)
  54.         ... 42 more
复制代码


struts code

  1. <?xml version="1.0" encoding="ISO-8859-1" ?>

  2. <!DOCTYPE struts-config PUBLIC
  3.           "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
  4.           "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">

  5. <struts-config>

  6. <data-sources>
  7.     <data-source>
  8.       <set-property property="autoCommit"
  9.                      value="false"/>
  10.       <set-property property="description"
  11.                      value="SQLServer"/>
  12.                      
  13.           <set-property property="driverClass"
  14.                      value="com.inet.tds.TdsDriver"/>                     
  15.                             
  16.       <set-property property="maxCount"
  17.                      value="50"/>
  18.       <set-property property="minCount"
  19.                      value="10"/>
  20.           <set-property property="url"
  21.                      value="jdbc:inetdae7:localhost?database=TOSS"/>
  22.       <set-property property="user"
  23.                      value="sa"/>
  24.       <set-property property="password"
  25.                         value="password"/>
  26.       <set-property property="username"
  27.                             value="sa"/>
  28.       <set-property property="password"
  29.                                 value="password"/>
  30.                     
  31.        
  32.     </data-source>
  33. </data-sources>

  34. <!--jdbc:inetdae7:127.0.0.1?database=TOSS-->
  35. <!--microsoft:sqlserver:-->
  36. <!-- ========== Form Bean Definitions =================================== -->
  37. <form-beans>
  38.         <form-bean name="caaCommForm" type="tess.caa.caaCommForm"/>
  39. </form-beans>

  40. <!-- ========== Global Forward Definitions ============================== -->
  41. <global-forwards>
  42. </global-forwards>

  43. <!-- ========== Action Mapping Definitions ============================== -->
  44. <action-mappings>

  45.   <action path="/caaCommAction"
  46.                   name="caaCommForm"
  47.                   scope="request"
  48.                   type="tess.caa.caaCommAction"
  49.                   parameter="1">
  50.         <!--Parameter 1:online   2:offline-->
  51.           <!--1:File   2:database-->
  52.         <set-property property="logMethod" value="1" />
  53.         <set-property property="logFilePath" value="c:\BSILog.txt" />
  54.   </action>

  55.     <action path="/ENG/caaCommAction"
  56.             name="caaCommForm"
  57.             scope="request"
  58.             type="tess.caa.caaCommAction"
  59.             parameter="1">
  60.                          <!--Parameter 1:online   2:offline-->
  61.         <!--1:File   2:database-->
  62.       <set-property property="logMethod" value="1" />
  63.       <set-property property="logFilePath" value="c:\BSILog.txt" />
  64.     </action>

  65.     <action path="/FSR/ENG/caaCommAction"
  66.             name="caaCommForm"
  67.             scope="request"
  68.             type="tess.caa.caaCommAction"
  69.             parameter="1">
  70.                          <!--Parameter 1:online   2:offline-->
  71.         <!--1:File   2:database-->
  72.       <set-property property="logMethod" value="1" />
  73.       <set-property property="logFilePath" value="c:\BSILog.txt" />
  74.     </action>
  75.          
  76.    
  77. </action-mappings>
  78. </struts-config>

复制代码



pls help

if i want to connect to microsoft access instead of sql server change to wat

  1. <data-sources>
  2.     <data-source>
  3.       <set-property property="autoCommit"
  4.                      value="false"/>
  5.       <set-property property="description"
  6.                      value="SQLServer"/>
  7.                      
  8.           <set-property property="driverClass"
  9.                      value="com.inet.tds.TdsDriver"/>                     
  10.                             
  11.       <set-property property="maxCount"
  12.                      value="50"/>
  13.       <set-property property="minCount"
  14.                      value="10"/>
  15.           <set-property property="url"
  16.                      value="jdbc:inetdae7:localhost?database=TOSS"/>
  17.       <set-property property="user"
  18.                      value="sa"/>
  19.       <set-property property="password"
  20.                         value="password"/>
  21.       <set-property property="username"
  22.                             value="sa"/>
  23.       <set-property property="password"
  24.                                 value="password"/>
  25.                     
  26.        
  27.     </data-source>
  28. </data-sources>

复制代码
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 3-3-2006 09:24 PM | 显示全部楼层
SQLException: Cannot load JDBC driver class 'null'
回复

使用道具 举报

seagull 该用户已被删除
发表于 3-3-2006 11:42 PM | 显示全部楼层
原帖由 Imnotsad 于 3-3-2006 09:24 PM 发表
SQLException: Cannot load JDBC driver class 'null'


JDBC driver 有在 classpath 里吗?
回复

使用道具 举报

发表于 4-3-2006 10:35 PM | 显示全部楼层
Are your sure this is the correct database URL

jdbc:inetdae7:localhost?database=TOSS

i think this should be something like this

    jdbc:dbnet://wombat:356/fred

[ 本帖最后由 pcstory 于 4-3-2006 10:38 PM 编辑 ]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 11-11-2024 01:43 PM , Processed in 0.092917 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表