how to solve this eroor

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" > 


<BODY bgcolor="#ffffcc">
    <FORM action="p.jsp" method="get"  name="f1">
    <TABLE style="background-color: #ECE5B6;" WIDTH="30%" >
	      <TH width="50%">Name</TH>
		  <TD width="50%"><INPUT TYPE="text" NAME="name"></TD>
	     <TH width="50%">City</TH>
		 <TD width="50%"><INPUT TYPE="text" NAME="city"></TD>
	     <TH width="50%">Phone</TH>
		 <TD width="50%"><INPUT TYPE="text" NAME="phone"></TD>
		  <TD width="50%"><INPUT TYPE="submit" VALUE="submit"></TD>
   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;



            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 {

i installed every thing

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

pls give me as fast as solution.


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.