public void procesVmDiskIoData() { try { PreparedStatement pstmt = sqlConnection.prepareStatement(Queries.getSqlInsertVmDiskInfo()); AggregationOutput aggregationOutput = mongoTask.getAggregatedOutput("diskio", Queries.getDiskIoQuery()); for (DBObject obj : aggregationOutput.results()) { String hostname = ((BasicDBObject) obj.get("_id")).getString("hostname"); String device = ((BasicDBObject) obj.get("_id")).getString("device"); double read = Double.parseDouble(obj.get("read").toString()); double write = Double.parseDouble(obj.get("write").toString()); pstmt.setTimestamp(1, new java.sql.Timestamp(timeStamp.getTime())); pstmt.setString(2, hostname); pstmt.setString(3, device); pstmt.setDouble(4, read); pstmt.setDouble(5, write); pstmt.setInt(6, 1); pstmt.addBatch(); } pstmt.executeBatch(); } catch (SQLException s) { s.printStackTrace(); } }