Limitation of OpenCSV Reader-Java

I used OpenCSV Reader – java to load my CSV File (file size:-1.47 GB (1,585,965,952 bytes)).

However, inside my coding, whenever it only manage to insert 10950 record to PostgreSQL database.

  CSVReader csvReader = new CSVReader(new FileReader(csvFilename));
    String[] row = null;

    String sqlInsertCSV = "insert into ip2location_tmp_test
    (ip_from, ip_to, xxxxx, "
    + "xxxxx, xxxxx,xxxxx, "
    + "xxxxx,xxxxx, xxxxx, xxxxx, xxxxx, xxxxx,xxxxx,xxxxx)"
    + " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; 

    while((row = csvReader.readNext()) != null) {

    PreparedStatement insertCSV = conn.prepareStatement(sqlInsertCSV);
    insertCSV.setLong(1, Long.parseLong(row[0]));
    insertCSV.setString(14, row[13]); // usage_type     
    PreparedStatement insertCSV = conn.prepareStatement(sqlInsertCSV); 


Is there any limitation of OpenCSV?

I need to use setString function to cater for single quote in PostgreSQL.

Source: java

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.