日期:2014-05-20 浏览次数:21002 次
File file = new File("image/temp.jpg");
FileInputStream fis = new FileInputStream(file);
System.out.println("aaa");
String insertInfo = "use student insert into stuInfo(id,name,sex,resume,photo) values(?,?,?,?,?)";
PreparedStatement ps = conn.prepareStatement(insertInfo);
ps.setInt(1, employee.getId());
ps.setString(2, employee.getName());
ps.setString(3, employee.getSex());
ps.setString(4, employee.getResume());
System.out.println(file.length()+":"+fis.available());
ps.setBinaryStream(5, fis,(int)file.length());
ps.execute();