I have written a small program to insert data, but I am not able to do that, my program runs till Out.println "4444" and then stops please help
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
public class BichhuServlet extends HttpServlet
{
public void BichhuServlet(){}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
ServletOutputStream out=response.getOutputStream();
String info=request.getParameter("information");
//String iName=request.getParameter("infoName");
//String iEmail=request.getParameter("infoEmail");
//String iTel=request.getParameter("infoTel");
//String iFax=request.getParameter("infoFax");
String iSubject=request.getParameter("infoSubject");
//String company=request.getParameter("comp");
Connection con=null;
String url = "jdbc:mysql://localhost/croreco_india123";
out.println("1");
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstan ce();
out.println("2");
}
catch (Exception E) {
E.printStackTrace();
}
out.println("3");
try { out.println("4444");
Statement stmt;
con = DriverManager.getConnection(url, "croreco_vineet", "14parasmaj");
out.println("5");
stmt = con.createStatement();
out.println("6");
stmt.executeUpdate("INSERT INTO ContactUsB (Subject, InfoRequired)VALUES('"+iSubject+"','"+info+"')");
out.println("data");
stmt.close();
con.close();
}
catch(SQLException ex) {
System.err.println("==> SQLException: ");
while (ex != null) {
System.err.println("Message: " + ex.getMessage ());
System.err.println("SQLState: " + ex.getSQLState ());
System.err.println("ErrorCode: " + ex.getErrorCode ());
ex = ex.getNextException();
System.out.println("");
}
}
out.close();
}
public String getServletInfo()
{
return "BichhuServlet Information";
}