当前位置: 代码迷 >> Sql Server >> 重新安装SQL SERVER2008后,JSP连接数据库出现异常
  详细解决方案

重新安装SQL SERVER2008后,JSP连接数据库出现异常

热度:68   发布时间:2016-04-27 11:49:33.0
重新安装SQL SERVER2008后,JSP连接数据库出现错误
数据库连接为:
SQL code
Connection ct;    public Connection getConn(){        try {            Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");            ct=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=happyLife", "sa", "123456789");        } catch (Exception e) {            // TODO: handle exception            e.printStackTrace();        }        return ct;    }

密码用户名之类的肯定没有错,之前没有卸载的时候还可以连接成功的,JSP程序没改动,就是卸载完数据库之后又重新安装之后出现错误了,我也不知道是什么原因,求救!!!
报错内容为:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:221)
at com.zy.service.connDB.getConn(connDB.java:11)
at com.zy.service.resourcesBeanBO.getNetPageCount(resourcesBeanBO.java:286)
at com.zy.controller.myNetServlet.doGet(myNetServlet.java:35)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.zy.tools.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:35)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

------解决方案--------------------
你原来不是用sql2008的吧,估计jdbc驱动要换一个
  相关解决方案