本篇内容主要讲解“java链接sql server 2000后出错的原因”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“java链接sql server 2000后出错的原因”吧!
目前成都创新互联已为近1000家的企业提供了网站建设、域名、虚拟主机、网站托管、企业网站设计、德令哈网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。java 链接sql server 2000 总结
Context envContext = (Context)initCtx.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/jieba");
conn = ds.getConnection();
执行后总是出现:
java.lang.NoSuchMethodError: com.microsoft.util.UtilDebug.setPrintWriter(Ljava/io/PrintWriter;)V
at com.microsoft.jdbc.base.BaseDriver.setupDebugging(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
at com.hero.analysis.service.base.DBConnection.getConnection(DBConnection.java:41)
at com.hero.analysis.service.base.JDBCFacade.getDataSource(JDBCFacade.java:72)
at com.hero.analysis.service.base.JDBCFacade.
at com.hero.analysis.dao.mysql.MysqlUserDAO.login(MysqlUserDAO.java:50)
at com.hero.analysis.service.UserBO.login(UserBO.java:27)
at com.hero.analysis.web.user.LoginAction.execute(LoginAction.java:39)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.hero.analysis.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:121)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.hero.analysis.util.CheckLoginFilter.doFilter(CheckLoginFilter.java:90)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
跟着程序走了以下,确实没有这个方法,郁闷了一天
经过反复调试后发现有几种可能造成这个原因
1.驱动程序的版本不对
2 .sql server 2000没有打补丁 必须打补丁
3 .检查sql server 2000 的驱动程序mssql.jar,msbase.jar,mssqlserver.jar,msutil.jar存放位置对不对,一般放在tomact/commen/lib下就可以,或放进class_path,或webinfo/lib下,一般情况下,放一个地方就可以了
4 .位置方对了还不行 那可以考虑jdbc驱动程序的版本对不对,如果你打了 sp2补丁 那么也要用for sp2 driver
到此,相信大家对“java链接sql server 2000后出错的原因”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
本文名称:java链接sqlserver2000后出错的原因-创新互联
分享链接:http://lswzjz.com/article/ddojdc.html