Please help me..i m getting this error in vista...
java.sql.SQLException:General error
at sun.jdbc.odbc.createSQLException(JdbcOdbc.java:6986)
at sun.jdbc.odbc.StandardError(JdbcOdbc.java:7114)
at sun.jdbc.odbc.SqlExecDirect(JdbcOdbc.java:3110)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbc.java:3110)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
....etc
there are 2 code pages..one is employee registration page and the details entered in this page is sent to EmpAddServlet....
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class EmpAddServlet extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException
{
PrintWriter out=response.getWriter();
//reading parameter from html form
String emp_name=request.getParameter("emp_name");
String emp_id=request.getParameter("emp_id");
String emp_age=request.getParameter("emp_age");
String dept_id=request.getParameter("dept_id");
String emp_salary=request.getParameter("emp_salary");
String emp_pass=request.getParameter("password");
String emp_address=request.getParameter("add");
String emp_ph=request.getParameter("phno");
System.out.println("Hello!!!");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:dsn","","");
out.println("U have Entered:"+emp_name);
out.println("U have Entered:"+emp_address+" "+emp_ph);
/*PreparedStatement pst=con.prepareStatement("insert into emp(emp_name,emp_id,emp_age,emp_salary,dept_id,emp_pass,emp_address,emp_ph) values (?,?,?,?,?,?,?,?) ");
pst.setString(1,emp_name);
pst.setString(2,emp_id);
pst.setString(3,emp_age);
pst.setString(4,emp_salary);
pst.setString(5,dept_id);
pst.setString(6,emp_pass);
pst.setString(7,emp_address);
pst.setString(8,emp_ph);
System.out.println("Hello again!!!");
int x=pst.executeUpdate();*/
Statement st=con.createStatement();
String query="insert into emp values ('"+emp_name+"','"+emp_id+"','"+emp_age+"','"+emp_salary+"','"+dept_id+"','"+emp_pass+"','"+emp_address+"','"+emp_ph+"')";
int x=st.executeUpdate(query);
System.out.println("Hello again 2 !!!");
out.println(x+"Emp Row is updated");
System.out.println(x);
}
catch(Exception e)
{
e.printStackTrace();
System.out.println('e');
}
}
}