-2

I am trying to write the data from ResultSet to csv file using Netbeans and OpenCSV. I added OpenCSV library:

import au.com.bytecode.opencsv.*;

...

 try {   CSVWriter writer = new CSVWriter(new FileWriter("C:\\test2.csv"), ',');
                        writer.writeAll(rs,includeHeaders);

                     }

                     catch (Exception e){}
                }

However I get the error:

cannot find symbol
  symbol:   variable includeHeaders
  location: class DBConnect

Am I missing some other imports?

1 Answers1

1

CSVWriter.writeAll(rs,includeHeaders) expects a ResultSet and a boolean as an argument. you need to declare includeHeaders.

or simply pass the boolean values like

     writer.writeAll(rs,true);
     writer.writeAll(rs,false);
PermGenError
  • 45,977
  • 8
  • 87
  • 106