hi

how to solve this eroor
____________________________________________
Class.forName("com.mysql.jdbc.Driver").newInstance();
___________________________________________________


this is my code
------------------------------------------------------------------------------------

<%@ page import="java.sql.*" %> 
<%@ page import="java.io.*" %> 


 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd" > 

<HTML>
<HEAD>
   
</HEAD>

<BODY bgcolor="#ffffcc">
    <FORM action="p.jsp" method="get"  name="f1">
    <TABLE style="background-color: #ECE5B6;" WIDTH="30%" >
    
      <TR>
	      <TH width="50%">Name</TH>
		  <TD width="50%"><INPUT TYPE="text" NAME="name"></TD>
	  </tr>
      <TR>
	     <TH width="50%">City</TH>
		 <TD width="50%"><INPUT TYPE="text" NAME="city"></TD>
	  </tr>
	  <TR>
	     <TH width="50%">Phone</TH>
		 <TD width="50%"><INPUT TYPE="text" NAME="phone"></TD>
	  </tr>
	  
	  <TR>
	      <TH></TH>
		  <TD width="50%"><INPUT TYPE="submit" VALUE="submit"></TD>
	  </tr>
   </TABLE>
<%
   String name = request.getParameter("name");
   String city = request.getParameter("city");
   String phone = request.getParameter("phone");


    String connectionURL = "jdbc:mysql://localhost:3306/test";

   
    Connection connection = null;

   
     PreparedStatement pstatement = null;

	
     Class.forName("com.mysql.jdbc.Driver").newInstance();

     

            try {
              
              connection = DriverManager.getConnection(connectionURL, "root", "root");

              
              String queryString = "INSERT INTO th(name,city,phone) VALUES (?, ?, ?)";

			
              pstatement = connection.prepareStatement(queryString);
              pstatement.setString(1, name);
			  pstatement.setString(2, city);
			  pstatement.setString(3, phone);
            
             
              }
            
            catch (Exception ex) {
            out.println("Unable to connect to batabase.");
   
            }
            finally {
               
                pstatement.close();
                connection.close();
            }
	 
%>
  </FORM>
 </body> 
</html>

----------------------------------------------------------------------------------------
i installed every thing

1)Tomcate 5.5
2)Mysql
3)jdk 1.6
4)jre6
5)mysql-connector-java-2.0.14-bin jar files
------------------------------------------------------------------------------------

pls give me as fast as solution.

thanks

Your post been moved from Introduction to JSP as it belongs here.
On top of the JSP section is sticky post JSP database connectivity according to Model View Controller (MVC) Model 2, which should help you get started with Java web development in regards of database connectivity, link is here

commented: Well you kept your cool else I would have had a few words o say regarding his "fast solution" request." +7
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.