String str="INSERT INTO employee(employee_id,last_name, salary, department_id)VALUES("+employee_id+","+last_name+","+ salary+","+ department_id+")"st.executeUpdate(str);out.println("\n数据插入完毕");st.close(); 
conn.commit();

解决方案 »

  1.   

    你把你插入数据库的str打印出来,看看你的sql语句有没有错误
      

  2.   

    首先指出楼主变量的问题,就是values后面的!
    1.employee_id,等后面的几个我没有在你的JSP页面中找到。2.你的字符串匹配可能有问题。比如:String employee_id = "001";
    String last_name = "aaa";
    则插这两个字符串时:
    insert into employee(employee_id,last_name) values(' + employee_id + "','"+ last_name + "'";