mith_cool 0 Junior Poster in Training

Exception in inserting date into database

String Fname= request.getParameter("txtfname");
        String Lname= request.getParameter("txtlname");
        String Uname=request.getParameter("txtuname");
        String Pass=request.getParameter("txtpass");
        String Email=request.getParameter("txtemail");
        String Gender=request.getParameter("group1");
        String Add=request.getParameter("txtadd");
        java.sql.Date  sqlDate = new java.sql.Date(new java.util.Date().getTime());
        //out.println(""+Fname+Lname+Uname+Pass+Email+Gender+Add);
        Connection con= null;
        //if(Fname != null && Lname != null && Uname != null && Pass != null && Email != null && Gender != null && Add != null)
        try
        {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            con=DriverManager.getConnection("jdbc:odbc:SQL","sa","mith1234");
            String insert="insert into sign_up values(?,?,?,?,?,?,?,?)";
            PreparedStatement ps= con.prepareStatement(insert);
            ps.setString(1,Fname);
            ps.setString(2,Lname);
            ps.setString(3,Uname);
            ps.setString(4,Pass);
            ps.setString(5,Email);
            ps.setString(6,Gender);
            ps.setString(7,Add);
            ps.setDate(8,sqlDate);
           // ps.setDate(9, null);
            int rt= ps.executeUpdate();
            Cookie c= new Cookie("Cuname", Uname);
            response.addCookie(c);
            response.sendRedirect("Home.jsp");
        }

        catch(ClassNotFoundException e)
        {
            out.println("Class not found :"+e.getMessage());
        }
        catch(SQLException s)
        {
            out.println("Sql exception: "+s.getMessage());
        }
        catch(Exception ex)
        {
            out.println(ex);
        }
    }

Exception:
Sql exception: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented

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.