日期:2014-05-18  浏览次数:20797 次

javaBean连接SQL Server 2000数据库
(1)我把msbase.jar   mssqlserver.jar三个文件放在WEB-INF\的lib文件下请问以下是怎么回事?
type   Exception   report

message  

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

exception  

org.apache.jasper.JasperException:   /ch9/jsp_javabean/addMessage.jsp(2,0)   The   value   for   the   useBean   class   attribute   com.jspdev.ch9.MessageVO   is   invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:150)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1227)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3272)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
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.
(2)我是用的Tomcat5.0+jdk1.4+sql   server   2000我的操作目录是C:\Tomcat   5.0\webapps\ROOT(Tomcat的安装目录)   lib下有msbase.jar   mssqlserver.jar   msutil.jar   三个目录   以下是我在光盘中的程序,请问以下程序怎样才能正常编译?

package   com.jspdev.ch9;
import   com.microsoft.jdbc.sqlserver.SQLServerDriver;
import   java.sql.*;
import   java.util.*;
public   class   MessageBean
{
    private   Connection   con;
    MessageVo   msg;
    public   MessageBean()
    {
        String   CLASSFORNAME= "com.microsoft.jdbc.sqlserver.SQLServerDriver ";
        String   SERVANDDB= "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=jspdev ";
        String   USER= "bn ";
        String   PWD= "bn ";
        try
        {
        Class.forName(CLASSFORNAME);
        con=DriverManager.getConnection(SERVANDDB,USER,PWD);
        }
        catch(Exception   e)
        {