The loadshp utility

The loadshp utility loads spatial features and associated attributes from an ESRI shapefile into a table in the HCL® OneDB® database.

When loadshp creates a table, it inserts a row into the geometry_columns system table. When you want to drop a table created by loadshp, you should also delete the corresponding row from the geometry_columns table.
Tip: The loadshp utility creates a primary key constraint on the se_row_id column of the table that you are loading.

Syntax


1  loadshp
1   -o
2.1 
2.2.1 %Append Mode
2.2.1 %Init and Create Mode
2.2.1 %SQL Mode
1  -V
Append mode

1  append   -l tablename , colname  -f filename   -D database?   -s server?   -u username  -p password?   -b begin_row?   -e end_row?   -c commit_interval?   -ic?   -log? directory
Init and create mode

1 create
1 init
2   -l tablename , colname  -f filename
2    -D database?   -s server?   -u username  -p password
2 ?   -b begin_row?   -e end_row
2 ?   -in dbspace?   -put sbspace_list
2 ?   -ext initial_extent_size?   -next next_extent_size
2?   -c commit_interval
2 ?  -ic?  -noidx
2?   -srid srid
2?   -log? directory
SQL mode

1  sql   -l tablename , colname  -f filename?   -in dbspace?   -put sbspace_list?   -ext initial_extent_size?   -next next_extent_size?   -log? directory

Operation modes

You use the -o flag to set the operation mode for the loadshp command. Set the -o flag to one of the following options:
append
Spatial features are added to the table specified by the -l flag. The structure of the existing database table must match the structure of a table derived from information specified by the -l command-line option and from metadata stored in the shapefile's associated .dbf file.
create
Spatial features are loaded into a newly created database table. An error is returned if a table with the name specified by the -l flag already exists. The structure of the new table is derived from the table name and column name specified by the -l command-line option as well as from metadata stored in the shapefile's associated .dbf file.
init
The table specified by the -l flag is first dropped and then spatial features are loaded into a newly created table of the same name.
sql
The following SQL statements are displayed on the console (and can be logged to a file):
  • DROP TABLE ...
  • DELETE FROM geometry_columns ...
  • CREATE TABLE ...
  • INSERT INTO geometry_columns ...
  • CREATE UNIQUE INDEX ... USING btree;
  • ALTER TABLE ... ADD CONSTRAINT PRIMARY KEY (se_row_id) ...
  • CREATE INDEX ... USING rtree;
  • UPDATE STATISTICS ...

The structure of the table to be loaded is derived from information specified by the -l command-line option and from metadata stored in the shapefile's associated .dbf file containing feature attributes.

Command-line switches

You can use the loadshp command-line switches to specify the following options.

-b (optional)
The first row in the shapefile to load
-c (optional)
The number of rows to load before committing work and beginning a new transaction

Defaults to 1000 rows

If you are loading data into a database that does not have transaction logging enabled, the commit interval determines how frequently information messages are displayed on the console.

-D
The database name
-e (optional)
The last row in the shapefile to load
-ext (optional)
Specifies the initial extent size for the table to be loaded

This option is not valid in the append option of the -o flag.

-f
The path and name of the ESRI shapefile to be loaded
-ic (optional)
Specifies use of an INSERT CURSOR

Using an INSERT CURSOR to load data significantly reduces load time, but limits the client program's ability to handle errors. INSERT CURSORs buffer rows before writing them to the database to improve performance. If an error is encountered during the load, all buffered rows following the last successfully inserted row are discarded.

-in (optional)
Specifies the dbspace in which to create the table to be loaded

This option is not valid in the append option of the -o flag.

-l
The table and geometry column to load data into
-log (optional)
Specifies whether to write information about the status of data loading to a log file

The log file has the same name as the shapefile you are loading from with the extension .log.

If you do not specify a directory, the log file is created in the same directory as the shapefile you are loading from.

-next
Specifies the next extent size for the table to be loaded

This option is not valid in the append option of the -o flag.

-noidx (optional)
Specifies that indexes should not be built and statistics should not be updated after the shapefile data has been loaded

Unless this option is specified when executing loadshp -o create or loadshp -o init, a unique B-tree index is built on the se_row_id column, an R-tree index is built on the geometry column, and statistics are updated for the table after the shapefile data has been loaded.

-p (optional)
The HCL OneDB password

If you specify the -p option, you must also specify the -u option.

-put (optional)
Specifies the sbspaces in which large shapes inserted into the load table's geometry column will be stored

Multiple sbspace names must be separated by commas and no white space must appear in the list of sbspace names. This option is not valid with the append option of the -o flag.

-s (optional)
The HCL OneDB server

Defaults to the value of the ONEDB_SERVER environment variable.

-srid (optional)
The spatial reference ID for the data you are loading

The integer you specify must exist as a spatial reference ID in the spatial_references table. If you do not specify the -srid command-line option, the spatial reference ID defaults to 0.

-u (optional)
The HCL OneDB user name

If you specify the -u option, you must also specify the -p option.

-V
Prints version information for this utility