Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Servlet/JSP/JSF/JavaFX Script  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to topicflat modethreaded modego to previous topicgo to next topicgo to back
作者 救命啊~~~JSP连接SQL数据库的问题~
naughty009





发贴: 56
于 2005-09-24 20:54 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
以下是我的JSP:
<%@ page contentType="text/html;charset=gb2312"%>

<%@ page import="java.sql.*"%>

<html>

<body>

<%

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();

String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs";

String user="sa";

String password="";

Connection conn= DriverManager.getConnection(url,user,password);

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

%>

<%out.print("数据库操作成功,恭喜你");%>

<%

stmt.close();

conn.close();

%>

</body>

</html>
出现的错误是:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

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.connsql_jsp._jspService(connsql_jsp.java:89)
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.connsql_jsp._jspService(connsql_jsp.java:61)
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)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

我将mssqlserver.jar,msbase.jar,msutil.jar都放在我的网站目录的WEB-INF\lib下了,
还是不行啊,只放mssqlserver.jar这个就出现
以下错误:

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: com/microsoft/jdbc/base/BaseDriver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.connsql_jsp._jspService(connsql_jsp.java:89)
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.lang.NoClassDefFoundError: com/microsoft/jdbc/base/BaseDriver
java.lang.ClassLoader.defineClass0(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:537)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:148)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:69)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:141)
org.apache.jsp.connsql_jsp._jspService(connsql_jsp.java:53)
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)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

我只想实现连接成功而已~
请大虾们帮帮手啊~~~~~~~



作者 Re:救命啊~~~JSP连接SQL数据库的问题~ [Re:naughty009]
YuLimin

简单就是美

版主


发贴: 866
于 2005-09-25 22:51 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Error establishing socket.

记得把SQL的SP3打上去就可以了。



 当兵不后悔!后悔不当兵! 
超越黎明时空,追逐时代潮流!
人,是要靠自己的!简单就是美!
我的Java:http://www.Java2Class.net
我的Blog:http://YuLimin.ItEye.com
作者 Re:救命啊~~~JSP连接SQL数据库的问题~ [Re:naughty009]
why

問題兒童

总版主


发贴: 4629
于 2005-09-26 17:06 user profilesend a private message to usersend email to whyreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Search here http://www.cjsdn.net/post/search
with keywords "Error establishing socket"



作者 Re:救命啊~~~JSP连接SQL数据库的问题~ [Re:naughty009]
naughty009





发贴: 56
于 2005-09-26 20:23 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
谢谢啦~!这个问题已经解决~~~~~


作者 Re:救命啊~~~JSP连接SQL数据库的问题~ [Re:naughty009]
YuLimin

简单就是美

版主


发贴: 866
于 2005-09-27 12:25 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
解决的方法是怎么样的,是不是跟我们解决的方法不一样?
如果不一样请写出你的经验,大家一起学习:)



 当兵不后悔!后悔不当兵! 
超越黎明时空,追逐时代潮流!
人,是要靠自己的!简单就是美!
我的Java:http://www.Java2Class.net
我的Blog:http://YuLimin.ItEye.com
作者 Re:救命啊~~~JSP连接SQL数据库的问题~ [Re:naughty009]
naughty009





发贴: 56
于 2005-09-27 12:47 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
打上sp3根本没用~~~~重装了系统吖~痛苦啊~~~~~~~再重装sql就行了~~~~唉~!都不知是什么回事啊~!

naughty009 edited on 2005-09-27 12:50

作者 Re:救命啊~~~JSP连接SQL数据库的问题~ [Re:naughty009]
flyingqifei

电脑为家 网络为舍



发贴: 35
于 2005-09-27 23:05 user profilesend a private message to usersend email to flyingqifeireply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
SP3还是要打的,现在新出了SP4,不是重装系统这么痛苦吧!那也没找着原因呀!以后再碰到岂不……


My website: http://flyingqifei.icpcn.com
My BLOG: http://qifei.blogbus.com

reply to topicflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2020 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号
客服电话 0592-8750026    客服信箱 714923@qq.com    客服QQ 714923