示例#1
0
 public int saveImageData(ImageDTO dto) throws Exception {
   Connection con = null;
   int ret;
   try {
     con = new MyConnection().getConnection();
     String query = "insert into tbl_tracker_image(username,c_date,c_time,fpath) values (?,?,?,?)";
     PreparedStatement ps = con.prepareStatement(query);
     ps.setString(1, dto.getUsername());
     ps.setString(2, dto.getC_date());
     ps.setString(3, dto.getC_time());
     ps.setString(4, dto.getFpath());
     ret = ps.executeUpdate();
     ps.close();
   } catch (Exception e) {
     e.printStackTrace();
     ret = 0;
   } finally {
     if (con != null) {
       con.close();
     }
   }
   return ret;
 }