Hello everybody,
I am getting the above error while executing the following servlet.This
servlet just inserts the user id and password into the database.Other
similar servlets like retrieving info from the database are all
working.This servlet is being run using Websphere.


public class InsertLoginServlet extends HttpServlet {

        private static String owner    =" db2inst3";
        private static String source   = null;

        private String name = null;
        private String passwd = null;

        public void init(ServletConfig config)throws ServletException{

                super.init(config);
                try {

                        Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
                } catch (Exception e) {
                        e.printStackTrace();
               }
        }//init
/* I tried by uncommenting the doGet Method also */
/*      public void doGet(HttpServletRequest req,HttpServletResponse res)
                throws ServletException , IOException {
                doPost(req,res);
        }*/
        public void doPost(HttpServletRequest req, HttpServletResponse res)
                throws ServletException , IOException{

                res.setContentType("text/html");
                PrintWriter out = res.getWriter();

                name=req.getParameter("UserId");
                passwd = req.getParameter("Password");

                Connection con = null;
                String url = "jdbc:db2:db2inst3";

                try {
                con = DriverManager.getConnection(url);

          Statement stmt = con.createStatement();

        ResultSet rs = stmt.executeQuery("INSERT into
"+owner.toUpperCase()+".pers "+"values "+"("+
passwd +","+name+")");


        out.println("<html><head><title>userinfo</title></head>");
                out.println("<body>");
                out.println("Welcome "+name);
                out.println("</body></html>");


        rs.close();
        stmt.close();
        con.close();
        } catch (Exception e){
            e.printStackTrace();
        }

}//doPost
}//class

Can anyone help me out.Thanks in advance.
regards,
 Kumar.
Visit: http://rajeshkj.homepage.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to