User`s guide
6 Using Database Toolbox Functions
6-26
Exporting Data Using Bulk Insert
In this section...
“About Bulk Insert Functionality” on page 6-26
“Bulk Insert into Oracle” on page 6-26
“Bulk Insert into Microsoft SQL Server 2005” on page 6-28
“Bulk Insert into MySQL” on page 6-30
About Bulk Insert Functionality
Many ways exist to insert data into your database using the command line. You can use
datainsert, fastinsert, or insert. For best performance with large volumes of data,
use datainsert or fastinsert.
If you still experience performance issues, create a data file with every record in your
data set. Then, you can use this data file as input into the bulk insert functionality
of your database to process the large data set. Additionally, you can insert data with
special characters such as double quotes with this file. Bulk insert provides performance
gains by using the bulk insert utilities that are native to different database systems. For
details about working with large data sets, see “Working with Large Data Sets”.
Bulk Insert into Oracle
This example shows how to export data to the Oracle server using bulk insert. For this
example, use a data file on the local machine where Oracle is installed.
1
Connect to the Oracle database.
javaaddpath 'path\ojdbc5.jar';
conn = database('databasename','user','password',...
'oracle.jdbc.driver.OracleDriver',...
'jdbc:oracle:thin:@machine:port:databasename');
2
Create a table named BULKTEST.
e = exec(conn,['create table BULKTEST (salary number, '...
'player varchar2(25), signed varchar2(25), '...
'team varchar2(25))']);
close(e)