欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

错误解决SQLException: [Microsoft][SQLServer 2000 Driver for

程序员文章站 2022-05-22 07:51:56
...

msbase.tar mssqlserver.jar msutil.jar 放在LIB目录下 代码如下: Class.forName(com.microsoft.jdbc.sqlserver.SQLServerDriver).newInstance(); Connection con=java.sql.DriverManager.getConnection(jdbc:microsoft:sqlserver://127.0.0.1:1433;Databas

msbase.tar mssqlserver.jar msutil.jar 放在LIB目录下

代码如下: Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); Connection con=java.sql.DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=dblink","sa",""); Statement stmt=con.createStatement(); ResultSet rst=stmt.executeQuery("select * from FYSH;");

出现错误:严重: Servlet.service() for servlet jsp threw exceptionjava.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Connection refused: connect at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) at com.microsoft.jdbc.sqlserver.tds.TDSConnection.(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(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at org.apache.jsp.testMssql_jsp._jspService(testMssql_jsp.java:71) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) at java.lang.Thread.run(Unknown Source)

后来网上查到 安装SQLSERVER SP4 就可以了 我安装了 发现还是不能用 晕结果 看了一下 安装的SP4 只是解压缩C:/SQL2KSP4 SQL2000.MSDE-KB884525-SP4-x86-CHS.EXE 一个低级错误 以后引以为戒