Hello Everyone,

I have created a sample which insert data from csv to SQL table, I used
RowInsertBuilder with BatchUpdateScript, it is working fine but takes too
much time to complete the operation because we have millions of rows in
csv.

I would need a better way to speedup the process, please let me know how
can I improve it, i.e. close the PreparedStatement after 10k rows or
something else, so few thousands rows  executed and it will free up the
list.

Current code block is:

final UpdateableDataContext dc = con.getUpdateableDataContext();
        dc.executeUpdate((BatchUpdateScript) callback -> {
            for (final Object[] rowData : buffer) {
                RowInsertionBuilder insertBuilder =
callback.insertInto(columns[0].getTable());
                for (int i = 0; i < columns.length; i++) {
                    insertBuilder = insertBuilder.value(columns[i],
rowData[i]);
                }
                try {
                    insertBuilder.execute();

                } catch (final RuntimeException e) {

                }
            }
});

-- 

Thanks,
Laxmilal Menaria | +91 982 955 3793 | http://laxmilalmenaria.com/

Reply via email to