jsp 连接sql sever 2000的问题,郁闷了…
一直没法连接成功,几天了,郁闷死了。先说下,测试程序没有问题,系统是XP+SP
2,然后sql server 也装了SP4的补丁。下面是输出页面,大家帮我分析下错误原因吧。
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: [Microsoft][SQLServer JDBC Driver]Error est
ablishing socket.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrap
per.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:37
7)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
javax.servlet.ServletException: [Microsoft][SQLServer JDBC Driver]Error establ
ishing socket.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextIm
pl.java:843)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl
.java:776)
org.apache.jsp.sql_005ftest_jsp._jspService(sql_005ftest_jsp.java:88)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:33
4)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Error establishing so
cket.
com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
com.microsoft.jdbc.sqlserver.tds.TDSConnection. <init> (Unknown Source)
com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
org.apache.jsp.sql_005ftest_jsp._jspService(sql_005ftest_jsp.java:55)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:33
4)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/
5.5.20 logs.
--
[解决办法]
楼主装了Microsoft SQL Server 2000 Driver for JDBC了吗?
------解决方案--------------------
SQL Server打最新补丁
[解决办法]
1 补丁 + 驱动
2 连接字符串
3 sqlserver设置,比如客户端协议是否禁用了TCP/IP
[解决办法]
1、看看SQL Server的版本号是否升级到了SP3或者SP4,微软的这两个升级包不会自动安装,需要解压后手动启动安装;
2、客户端和服务端的TCP端口号是否一致?可以在控制台窗口中用netstat -na看看是否监听了1433端口号;
3、JDBC驱动可以用2005 1.1版,就一个sqljdbc.jar包,支持2000,但是驱动和URL变了,可自己参考help文档
[解决办法]
你的把SQLServer的三个驱动文件加上,然后还得把SqlServer的SP4补丁装上,这个问题就解决了
[解决办法]
提示错误页面显示如下:
The method getStrisng(int) is undefined for the type ResultSet
这不都告诉你为什么出错了吗?。。。ResultSet的数据获取方法是getString(int)或者getString(String),不是getStrisng(int)!!!拼写错了!!!
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html