1.1.1

Table Of Contents
Example
The following example imports data into the STAFF table from a delimited data le called myfile.del.
Individual elds are separated by semicolons (;) and 6 parallel threads are used. The import procedure does not
lock the target table:
CALL SYSCS_UTIL.IMPORT_TABLE_EX (null, 'STAFF', 'c:/output/myfile.del',
';', null, null, 0,
0 /* don't lock the table */,
6 /* threads to use for import */,
0 /* case insensitive table name */,
null /* use the default import implementation */,
null /* unused, null required */)
Example with Custom Import Class
The following example uses a custom import implementation class to import data into the STAFF table from a
delimited data le called myfile.del. Individual elds are separated by semicolons (;) and 6 parallel threads
are used. The import procedure does not lock the target table:
CALL SYSCS_UTIL.IMPORT_TABLE_EX (null, 'STAFF', 'c:/output/myfile.del',
';', null, null, 0,
0 /* don't lock the table */,
6 /* threads to use for import */,
0 /* case insensitive table name */,
'examples.load.ImportFromOracle' /* use a custom import implementation */,
null /* unused, null required */)
The custom import implementation transforms Oracle DATE strings for SQLFire:
public class ImportFromOracle extends com.vmware.sqlfire.load.Import {
public ImportFromOracle(String inputFileName, String columnDelimiter,
String characterDelimiter, String codeset, long offset, long
endPosition,
int noOfColumnsExpected, String columnTypes, boolean lobsInExtFile,
int importCounter, String columnTypeNames, String udtClassNamesString)
throws SQLException {
super(inputFileName, columnDelimiter, characterDelimiter, codeset,
offset,
endPosition, noOfColumnsExpected, columnTypes, lobsInExtFile,
importCounter, columnTypeNames, udtClassNamesString);
}
@Override
public String getString(int columnIndex) throws SQLException {
String val = super.getString(columnIndex);
if (val != null && val.length() > 0) {
switch (getColumnType(columnIndex)) {
// assuming incoming format YYYYMMDD for DATE columns
// and YYMMDDHH:MI:SS for TIMESTAMP columns
// SQLFire format is YYYY-MM-DD HH:MI:SS
case java.sql.Types.DATE:
return val.substring(0, 4) + '-' + val.substring(4, 6) + '-'
+ val.substring(6, 8);
case java.sql.Types.TIMESTAMP:
return val.substring(0, 4) + '-' + val.substring(4, 6) + '-'
+ val.substring(6, 8) + ' ' + val.substring(8);
default:
return val;
vFabric SQLFire User's Guide606
vFabric SQLFire Reference