@Override public void write(NullWritable key, T record) throws IOException { try { record.write(pstmt); numRecords++; pstmt.executeUpdate(); if (numRecords % batchSize == 0) { LOG.debug("Commit called on a batch of size : " + batchSize); conn.commit(); } } catch (SQLException e) { throw new IOException("Exception while writing to table.", e); } }
@Override public void write(NullWritable n, T record) throws IOException, InterruptedException { try { record.write(statement); numRecords++; statement.execute(); if (numRecords % batchSize == 0) { LOG.debug("commit called on a batch of size : " + batchSize); conn.commit(); } } catch (SQLException e) { throw new RuntimeException("Exception while committing to database.", e); } }
@Override public void write(NullWritable n, T record) throws IOException, InterruptedException { try { record.write(statement); numRecords++; statement.execute(); if (numRecords % batchSize == 0) { LOG.debug("commit called on a batch of size : " + batchSize); conn.commit(); } } catch (SQLException e) { throw new RuntimeException("Exception while committing to database.", e); } }
@Override public void write(NullWritable n, T record) throws IOException, InterruptedException { try { record.write(statement); numRecords++; statement.execute(); if (numRecords % batchSize == 0) { LOG.debug("commit called on a batch of size : " + batchSize); conn.commit(); } } catch (SQLException e) { throw new RuntimeException("Exception while committing to database.", e); } }