• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to solve class not found exception and data not insert in database

 
tillu Sharma
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear friends,
i don't have remove class not find error......and servlet not inserted data in database............what kind of this problem ..friend solve this problem and give me suggestion...please

datatype in database is varchar2


Database class:

package work;
import java.sql.*;
public class Jdbc_Connection
{
public java.sql.Connection con=null;

public Connection getconnection()
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = java.sql.DriverManager.getConnection("jdbcracle:thin:@localhost:1521:XE","system","password");
}
catch(Exception ex)
{
ex.printStackTrace();
return (null);
}
return con;
}



}





User_Servlet class:

package work;

import java.io.IOException;
import java.sql.*;
import java.sql.PreparedStatement;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* Servlet implementation class User_Servlet
*/
public class User_Servlet extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public User_Servlet() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}

/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
try
{
int i;
Jdbc_Connection JConnection =new Jdbc_Connection();
System.out.println("Hello");
//Statement stmt=null;
String firstName = request.getParameter("Firstname");
String lastName = request.getParameter("Lastname");
String email = request.getParameter("Email");
String confirmEmail = request.getParameter("Confirm_Email");
String password = request.getParameter("Password");
Connection con = JConnection.getconnection();
PreparedStatement ps=con.prepareStatement("insert into USER_INFO values(?,?,?,?)");
ps.setString(3, email);
ps.setString(1, firstName);
ps.setString(2, lastName);
ps.setString(4,password);
i = ps.executeUpdate();
System.out.print(i);
// System.out.println("This is the SErvlet"+firstName);
//response.sendRedirect("/pages/signin.html");
javax.servlet.RequestDispatcher rd = null;
rd = request.getRequestDispatcher("/pages/signin.html");
rd.forward(request, response);
// con.close();
}
catch(Exception e)
{
System.out.println("i m in servlet exception......");

}
}

}
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't follow. Are you saying you see an exception running this code or not?
 
tillu Sharma
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, exception is occur in this program..........
 
Sunny Bhandari
Ranch Hand
Posts: 448
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am asking you provide the stacktrace of the exception...
 
tillu Sharma
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic