skip to main content
Using the JDBC Client : 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 examples.

Example A: Creating a DDBulkLoad Object for an OpenAccess Connection

import com.ddtek.jdbc.extensions.*
// Get Database Connection
Connection con = DriverManager.getConnection(
"jdbc:openaccess://<host>:<port>;ServerDataSource=<serverdatasource>;
User=<userid>;Password=<password>;";
 
// Get a DDBulkLoad object
DDBulkLoad bulkLoad = com.ddtek.jdbc.extensions.DDBulkLoadFactory.getInstance(con);

Example B: Loading Data Using a ResultSet Object

Suppose after upgrading from an OpenAccess Data Source 1 to an OpenAccess Data Source 2, you need to migrate data from the old database to the new database. The following figure shows how your application would load the data from a ResultSet object created from a query. This scenario assumes that the OpenAccess driver is connected to both databases.
1. The application executes a query to the OpenAccess Data Source 1 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 OpenAccess Data Source 2.
3. The driver loads the data from the ResultSet object into the OpenAccess Data Source 2 table.

Example C: Loading Data Using a CSV File

Using the same scenario as described in Example B, 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 an OpenAccess Data Source 1 table.
1. The application creates a DDBulkLoad object
2. The application specifies that the driver export the data from an OpenAccess Data Source 1 table into a CSV file.
3. The application instructs the driver to load data from the CSV file into the OpenAccess Data Source 2 table. The driver loads the data from the CSV file into the OpenAccess Data Source 2 table.
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 DataDirect Bulk Load Methods for a description of the bulk load methods.