Loading data from a CSV file
- Last Updated: May 13, 2025
- 1 minute read
- DataDirect Connectors
- JDBC
- Documentation
Use the setTableName() method to specify the table to load the data. Then, use the load() method, specifying the CSV file. For example, to load data from a file named tmp.csv into a table named GBMAXTABLE, you would specify:
bulkLoad.setTableName("GBMAXTABLE");
and
bulkLoad.load("tmp.csv");
Alternatively, you can create a file reference to the CSV file, and use the load() method to specify the file reference:
File csvFile = new File("tmp.csv");
bulkLoad.load(csvFile);
Use the BulkLoadBatchSize property to specify the number of rows the driver loads at a time when bulk loading data. Performance can be improved by increasing the number of rows the driver loads at a time because fewer network round trips are required. Be aware that increasing the number of rows that are loaded also causes the driver to consume more memory on the client.