Topic: 请教各位,为什么我这样在JSP中直连SYBASE数据库连不上呢?

  Print this page

1.请教各位,为什么我这样在JSP中直连SYBASE数据库连不上呢? Copy to clipboard
Posted by: xieqr
Posted on: 2005-12-15 09:54

Class.forName("com.sybase.jdbc3.jdbc.SybDriver ").newInstance();
Connection con = DriverManager.getConnection("jdbc:sybase:Tds:132.108.32.17:8000/skywindb","wgusr","skywin");
其中:132.108.32.17:8000是数据库主机的IP地址和端口号,skywindb,wgusr,skywin分别为数据库名,用户名和密码
请教各位,为什么我这样在JSP中直连SYBASE数据库连不上的?

2.Re:请教各位,为什么我这样在JSP中直连SYBASE数据库连不上呢? [Re: xieqr] Copy to clipboard
Posted by: 九佰
Posted on: 2005-12-15 10:42

有什么错误信息,发来看看

3.Re:请教各位,为什么我这样在JSP中直连SYBASE数据库连不上呢? [Re: xieqr] Copy to clipboard
Posted by: why
Posted on: 2005-12-15 11:55

>Class.forName("com.sybase.jdbc3.jdbc.SybDriver ").newInstance();
SybDriver " // should not have trailing space.

Anyway, one should have posted the error message when asking this type of question.

4.Re:请教各位,为什么我这样在JSP中直连SYBASE数据库连不上呢? [Re: xieqr] Copy to clipboard
Posted by: xieqr
Posted on: 2005-12-15 12:26

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: com.sybase.jdbc3.jdbc.SybDriver
  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
  at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
  at java.lang.Thread.run(Thread.java:534)

root cause

javax.servlet.ServletException: com.sybase.jdbc3.jdbc.SybDriver
  at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
  at org.apache.jsp.fzhmquery_jsp._jspService(fzhmquery_jsp.java:347)
  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
  at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
  at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
  at java.lang.Thread.run(Thread.java:534)

--------------------------------------------------------------------------------

Apache Tomcat/4.1.30

5.Re:请教各位,为什么我这样在JSP中直连SYBASE数据库连不上呢? [Re: xieqr] Copy to clipboard
Posted by: xieqr
Posted on: 2005-12-15 14:11

是这样的,以前我通过JDBC-ODBC桥来访问数据库连接就是很正常的,可以连上,但有个问题是查询只在查数据库里有记录的才正常,如果数据库里没有记录的话就会返回错误信息。所以我们想是不是数据库的驱动程度有问题,因此我们改用直连SYBASE的方式来看一下看怎么样,可是这样直连却连连接都成了问题。所以想请教各位怎么会有这种情况,其实我们真正的问题是:RS查询结果集如果是空的话就会出错,好象看网上例子程序里访问数据库的代码也没有对RS为空的时候做特殊的处理呀。
而且我在家里用同样的代码访问ACCESS数据库的时候就完全正常,查询不到就会返回“查不到”这样的信息,所以只能是跟SYBASE数据库与JSP的连接有关了,不知道我把问题说清楚了没,请各位帮忙分析一下,谢谢。

6.Re:请教各位,为什么我这样在JSP中直连SYBASE数据库连不上呢? [Re: xieqr] Copy to clipboard
Posted by: xieqr
Posted on: 2005-12-16 09:12

郁闷中。。。
各位高人帮忙分析一下?感激ING

7.Re:请教各位,为什么我这样在JSP中直连SYBASE数据库连不上呢? [Re: xieqr] Copy to clipboard
Posted by: chinamicrofox
Posted on: 2006-01-05 02:14

数据库中没有数据当然会抛出查询异常了,建议加强基础知识的学习


   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