The first step in performing a bulk load operation using a DDBulkLoad object is to create a DDBulkLoad object. A DDBulkLoad must be created with the getInstance method using the DDBulkLoadFactory class as shown in the following example.
import com.ddtek.jdbc.extensions.*
// Get Salesforce Connection
Connection con = DriverManager.getConnection(
"jdbc:datadirect:sforce://login.salesforce.com;User=abc@defcorp.com;
Password=secret;SecurityToken=XaBARTsLZReM4Px47qPLOS");
// Get a DDBulkLoad object
DDBulkLoad bulkLoad = com.ddtek.jdbc.extensions.DDBulkLoadFactory.getInstance(con);
Once the DDBulkLoad object has been created, DDBulkLoad methods can be used to instruct the driver to obtain data from one location and load it to another location. The driver can obtain data either from a ResultSet object or from a CSV file.
Migrating Data Using a ResultSet Object
The following steps would need to be taken to migrate data from Oracle to Salesforce using a ResultSet object.
Important: This scenario assumes that you are using the DataDirect Oracle driver to query the Oracle database and the DataDirect Salesforce driver to insert data on the Salesforce data store.
1. The application creates a DDBulkLoad object.
2. The application executes a standard query on the Oracle database, and the Oracle driver retrieves the results as a ResultSet object.
3. The application instructs the Salesforce driver to load the data from the ResultSet object into Salesforce. (See "Loading Data From a ResultSet Object".)
Migrating Data Using a CSV File
The following steps would need to be taken to migrate data from Oracle to Salesforce using a CSV file.
1. The application creates a DDBulkLoad object.
2. The application instructs the Oracle driver to export the data from the Oracle database into a CSV file. (See "Exporting Data to a CSV File.")
3. The application instructs the Salesforce driver to load data from the CSV file into Salesforce. (See "Loading Data From a CSV File.")