当前位置: 代码迷 >> Java Web开发 >> [求助]JSP连接数据库SQL Server2000问题
  详细解决方案

[求助]JSP连接数据库SQL Server2000问题

热度:273   发布时间:2006-03-25 12:40:00.0
[求助]JSP连接数据库SQL Server2000问题

exception

javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
	org.apache.jsp.ch9._1_jsp._jspService(_1_jsp.java:86)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
	com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
	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(DriverManager.java:512)
	java.sql.DriverManager.getConnection(DriverManager.java:171)
	org.apache.jsp.ch9._1_jsp._jspService(_1_jsp.java:52)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
请问这是怎么回事?
我的jdk目录为C:\j2sdk1.4.2_05
tomcat目录为C:\Tomcat 5.0
数据库目录为C:\Program Files\Microsoft SQL Server
驱动目录为C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC
并把C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib下的三个包拷贝到了
C:\Tomcat 5.0\common\lib下,并在环境变量里的CLASSPATH下添加了这三个包
请高手帮忙
搜索更多相关主题的帖子: SQL  数据库  JSP  

----------------解决方案--------------------------------------------------------
你是用什么进行连接的?
记得那3个包应该是copy到tomcat\webapps\工程名\WEB-INF\lib下
----------------解决方案--------------------------------------------------------

一般出现这个信息,主要是数据库出错了!可能你安装了防火墙,这时你需要把防火墙关掉,在关闭SQL SERVER 服务管理,然后在起动服务管理。就OK了,也不知道是不是你出错的原因!如果不对请包含!


----------------解决方案--------------------------------------------------------
  相关解决方案