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

您没有登录

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

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 JSP连接SQL SERVER出错,不知道错在哪里,请各位帮忙
henbane





发贴: 42
于 2005-03-17 19:01 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
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection conn = DriverManager.getConnection
("jdbc:microsoft:sqlserver://localhost:1433;User=sa;Password=hbcj602");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from namelist";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
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: com.microsoft.jdbc.sqlserver.SQLServerDriver
  org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
  org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
  org.apache.jsp.connect_jsp._jspService(org.apache.jsp.connect_jsp:94)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver

==》我装了SQL SERVER的JDBC




话题树型展开
人气 标题 作者 字数 发贴时间
2681 JSP连接SQL SERVER出错,不知道错在哪里,请各位帮忙 henbane 1718 2005-03-17 19:01
1941 Re:JSP连接SQL SERVER出错,不知道错在哪里,请各位帮忙 chengbd 73 2005-03-17 20:50
2258 Re:JSP连接SQL SERVER出错,不知道错在哪里,请各位帮忙 henbane 99 2005-03-17 21:42
2288 Re:JSP连接SQL SERVER出错,不知道错在哪里,请各位帮忙 henbane 52 2005-03-18 19:14
2327 Re:JSP连接SQL SERVER出错,不知道错在哪里,请各位帮忙 henbane 59 2005-03-18 19:27

reply to postflat 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-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923