skip to main content
About the Driver : Using the Driver : Using DataDirect Bulk Load : Using a DDBulkLoad Object
  
Using a DDBulkLoad Object
To create a DDBulkLoad object, create an instance of the DDBulkLoadFactory class as shown in the following example.
import com.ddtek.jdbc.extensions.*
// Get Database Connection
Connection con = DriverManager.getConnection(
   "jdbc:datadirect:redshift://server3:5439;
DatabaseName=Test;User=admin;Password=secret");

// Get a DDBulkLoad object
DDBulkLoad bulkLoad = com.ddtek.jdbc.extensions.DDBulkLoadFactory.getInstance(con);
Once your application has created a DDBulkLoad object, you can use the DDBulkLoad methods to provide the driver with the following instructions:
*The location where the driver obtains the data to load. The driver can obtain data from either of the following sources:
*ResultSet object generated from a query.
*Comma-separated value (CSV) file. The driver can export data from a table or ResultSet object into a CSV file, or the driver can use a CSV file created by another DataDirect Connect product.
*The location where the driver loads the data.
Suppose you need to migrate data from database system X to database Y. The following figure shows how your application would load the data from a ResultSet object created from a query. This scenario assumes that the driver is connected to both databases.
Image showing the migration of data from one serve to another via the bulk load process
1. The application executes a query to the X database in the normal way and retrieves the results in a ResultSet object.
2. The application creates a DDBulkLoad object and instructs the driver to load data from the ResultSet object into the Y database.
3. The driver loads the data from the ResultSet object into the table.
The following figure shows how you would load the data using a CSV file instead of a ResultSet object. The CSV file is created by exporting data from a table on the X database.
Image showing the migration of data from one serve to another via the bulk load process
1. The application creates a DDBulkLoad object.
2. The application specifies that the driver export the data from a table on database X into a CSV file.
3. The application instructs the driver to load data from the CSV file into the table on database Y table. The driver loads the data from the CSV file into the table on database Y.
For instructions on exporting data to a CSV file, see Exporting Data to a CSV File.
For instructions on loading data, see Loading Data From a ResultSet Object and Loading Data From a CSV File.
See Permissions for Bulk Load from a CSV File for information about granting permissions for bulk loading from a CSV file.
See JDBC Extensions for more information about bulk load methods.
In this section: 
* Exporting Data to a CSV File
* Loading Data From a ResultSet Object
* Loading Data From a CSV File
* Specifying the Bulk Load Operation
* Logging