无法将驱动程序管理器解析为

时间:2016-06-21 11:23:05

标签: java sql

我的JSP程序如下所述。这个程序我试图在tomact服务器上运行,但没有得到满足我想要的东西。

      <%@page import="java.sql.*"%>
        <%@page import="java.io.*"%>
        <%@page import="java.lang.*"%>
        <%@page import="java.sql.DriverManager" %>
        <%@page import="java.util.*"%>
        <%@page import="java.sql.Connection"%>
        <%!int  a=9;%>
        <%!int i=0;%>

        <%


   try{
        Connection con=null;
                PreparedStatement ps=null;
                ResultSet rs=null,re=null;
            Statement st=null;

            String fname,lname,pass,retypepass,gender,dob,age,email,phn;

            fname=request.getParameter("name");
            lname=request.getParameter("name1");

            pass=request.getParameter("pwd");
            retypepass=request.getParameter("pwd1");
            gender=request.getParameter("gender");
            dob=request.getParameter("day");
            email=request.getParameter("mailid");

            for(i=0;i<email.length();i++)
            {
                a+=i;
            }
            out.println("your registration id is:"+a);
            String regid=String.valueOf(a);
            DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
            con=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:xe","system","system");
            st=con.createStatement();     
                    ps=con.prepareStatement("insert into Register3 values(?,?,?,?,?,?,?,?)");
                    ps.setString(1,fname);
                ps.setString(2,lname);
                ps.setString(3,regid);
                ps.setString(4,pass);
                ps.setString(5,retypepass);
                ps.setString(6,gender);
                ps.setString(7,dob);
                ps.setString(8,email);


                ps.executeUpdate();
                %>
                <html>
        <head>
        <script type="text/javascript">
        alert(" Thank you for Registration...!!");
        </script>
        </head>
        <body>
        <center>
            <h1><a href="login.html">login</a></h1>
        </center>
        </body>
        </html>
            <%
            ps.close();         
            con.close();

    }
    catch(Exception e)
    {
        out.println("Error message:"+e);
    %>
        <html>
        <head>
        <script type="text/javascript">
        alert(" THIS USER ALREDY EXIT...!!");
        </script>
        </head>
        <body>
        <center>
            <h1><a href="registration.html"></a></h1>
        </center>
        </body>
        </html>

    <%  


    }

%>  

以上代码显示以下错误

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 34 in the jsp file: /register.jsp
oracle.jdbc.OracleDriver cannot be resolved to a type
31:             }
32:             out.println("your registration id is:"+a);
33:             String regid=String.valueOf(a);
34:             DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
35:             con=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:xe","system","system");
36:             st=con.createStatement();     
37:                     ps=con.prepareStatement("insert into Register3 

    values(?,?,?,?,?,?,?,?)");



Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:490)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:379)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:662)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

如何解决这个错误请帮帮我。请建议我。

1 个答案:

答案 0 :(得分:1)

您在运行时错过了类路径中的Oracle驱动程序..

download并将其添加到tomcat / lib目录