Dump and load table data using Data Admin Utilities
- Last Updated: October 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
- The
DataAdminServiceclass. - The IDataFile utility from the
OpenEdge.DataAdminpackage.
- The following utilities from the
OpenEdge.DataAdmin.Utilpackage:
For details on how to perform the dump and load operations in the OpenEdge database, see "Dumping and Loading" in Manage the OpenEdge Database.
customer and
salesrep tables when connected to the sports2000
database:
|
The code starts the DataAdminService instantiating the
TableExportUtility using the
UtilityFactory:GetUtility. It then passes the instance to the
DataAdminService:ExecuteUtility to dump the data. After the
execution, the code uses the Files:Iterator to loop through the
IDataFile instances to gather information about details and
status of the dump operation.
The code example adds tables to the table collection of the utility for processing
two specific tables, customer and salesrep, while
performing the dump operation. It uses the GetTable() method from
the DataAdminService to add the customer table
object to the instance as follows:
|
The following table lists the properties used in the dump table data code along with their descriptions:
| Property | Description |
|---|---|
LogStatus |
It instructs the chosen utility to record the dump status to the files collection. |
Directory |
It is the directory path where the data must be written for
the dump operation. You must give this location before you run
the code. If you leave the dataWriter.Directory
field blank, the tables get dumped into the current working
directory. |
OverwriteFiles |
If set to If set to the default value of |
The following code loads the table data from the specified directory:
|
The code starts the DataAdminService instantiating the
TableImportUtility using the
UtilityFactory:GetUtility. It then passes the instance to the
DataAdminService:ExecuteUtility to load the data. After the
execution, the code uses the Files:Iterator to loop through the
IDataFile instances for gathering information about details and
status of the load operation.
| Property | Description |
|---|---|
LogStatus |
It instructs the chosen utility to record the load status to the files collection. |
Directory |
It is the directory from where the data must be read for the
load operation. You must give this location before you run the
code. If you leave the DataReader.Directory
field blank, the tables get loaded from the current working
directory. |
AcceptableErrorPercentage |
It is the percentage of error that is acceptable per .d file. 0─Stops the load of .d file on first error. >0─Continues the load of .d file till the error percentage reaches. 100─Continue the load operation and ignores the errors, if any. |
IgnoreMissingDirectories |
If set to If set to the default value of |
- You can add tables to the table collection of the utility for processing
only the specific tables while performing the load operation. Use the
GetTable()method from theDataAdminServiceto add the table object as follows:dataWriter:Tables:Add(service:GetTable("customer")). - If
IDataFile:AnyErrorreturnsFALSE, the data is presumed to have been loaded. IDataFile:ExpectedNumRowsreads and returns the total number of rows to be processed from the .d trailer for the load operation. However, it is possible to load the data from the .d file without a trailer, in which case theIDataFile:ExpectedNumRowsdoes not return any value.-
IDataFile:ProcessedNumRowsreturns the value of the actual number of rows loaded from the .d trailer for the load operation. IDataFile:ErrorMessagerecords the top-level error message.- The .e file records detailed errors for a failed load
operation. You can locate this file using the
IDataFile:Filename. - You can use the
ValidateOnlyproperty of theITableDataUtilityand set it toTRUEto perform a validation request that only checks for:- The availability of files and directories
- If the load execution can be completed.