Using the methods provided for bulk load, the driver can export data from either of the following sources into a CSV file:
• Database table. Use the setTableName() method, specifying the table name. For example, to export data from a table named GBMAXTABLE to a file named tmp.csv, you would specify:
bulkLoad.setTableName("GBMAXTABLE");
and
bulkLoad.export("tmp.csv");
NOTE: Alternatively, you can create a file reference to the CSV file and use the export() method to specify the file reference:
File csvFile = new File ("tmp.csv");bulkLoad.export(csvFile);
• ResultSet object. Create a file reference to a CSV file, and use the export() method, specifying the ResultSet object and the file reference. For example, to export data from a ResultSet Object named rs to a file named tmp.csv, you would specify:
File csvFile = new File ("tmp.csv");
bulkLoad.export(rs, csvFile);
If the CSV file does not already exist, the driver creates it when the export() method is executed. The driver also creates a bulk load configuration file, which describes the structure of the CSV file. For more information about using CSV files, see Using CSV Files. See DataDirect Bulk Load Methods for more information about bulk load methods.