1 Replies - 1320 Views - Last Post: 26 February 2014 - 10:53 AM

#1 DeepaKubendran  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 02-December 13

cannot find symbol method forName(String) Compilation error

Posted 26 February 2014 - 10:50 AM

I have tried following jdbc coding. But it leads to a compilation error "cannot find symbol method forName(String)".I cant find understand for which this error has been come. Can anyone tell me? I have included my code below:
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
         <%@page import="java.sql.*" %>
        <% 
          
        String name=request.getParameter("Name");
        String regno=request.getParameter("Regno");
        String dob=request.getParameter("DOB");
        String Class=request.getParameter("Class");
        String yos=request.getParameter("YOS");
        String add=request.getParameter("Address");
        int phno=Integer.parseInt(request.getParameter("Phno"));
        String eid=request.getParameter("EID");
        
        try
        {
        Class.forName("com.mysql.jdbc.Driver");
        Connection c=DriverManager.getConnection("jdbc:mysql://localhost:8084/pms","root","root");
       
        String s="insert into stu_reg values(?,?,?,?,?,?,?,?)";
        PreparedStatement ps=c.prepareStatement(s);
      
        ps.setString(1,name);
        ps.setString(2,regno);
        ps.setString(3,dob);
        ps.setString(4,Class);
        ps.setString(5,yos);
        ps.setString(6,add);
        ps.setInt(7,phno);
        ps.setString(8,eid);
        int res=ps.executeUpdate();
        if(res==1)                       
            out.println("Success");                       
        else                       
            out.println("Failure");                      
        }
        catch(Exception ex){out.println(ex.getMessage());}%>
    </body>
</html>




Is This A Good Question/Topic? 0
  • +

Replies To: cannot find symbol method forName(String) Compilation error

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10368
  • View blog
  • Posts: 38,404
  • Joined: 27-December 08

Re: cannot find symbol method forName(String) Compilation error

Posted 26 February 2014 - 10:53 AM

This is a Java EE question, not an HTML/CSS question. Moved to Java EE.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1