henbane
![](images/star2.gif) ![](images/star1.gif) ![](images/star1.gif) ![](images/star1.gif)
发贴: 42
|
于 2005-03-17 19:01
![user profile](images_zh_CN/icons/icon_profile.gif) ![send a private message to user](images_zh_CN/icons/icon_pm.gif) ![reply to post](images_zh_CN/icons/icon_quote.gif) ![search all posts by](images_zh_CN/icons/icon_find.gif) ![select and copy to clipboard.
ie only, sorry for netscape users:-)](images_zh_CN/icons/icon_copy.gif)
<%@ 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
|