The DB2 Everyplace Command Line Processor for Palm OS, Symbian OS, Windows CE, Win32 platforms, Neutrino, and embedded Linux supports importing data from a file to DB2 Everyplace and exporting DB2 Everyplace data to a file. Importing and exporting data on the Palm OS uses the memo files on the device.
Procedure
Importing data from a file to DB2 Everyplace
To import data from a file on the mobile device to DB2 Everyplace, type:
IMPORT FROM file_name OF DEL INSERT INTO table_name [(column list)]file_name is the name of the file to import from.
On Palm OS, file_name is the name of the memo to import from. The file name must appear on the first line of the memo. Palm memos have a limitation of storing 4K bytes text. table_name is the name of an existing table to import into. For example, to import data from a file named mydata.txt to an existing table named mytable, type:
IMPORT FROM mydata.txt OF DEL INSERT INTO mytable
Exporting data from DB2 Everyplace to a file
To export data from DB2 Everyplace to a file, type:
EXPORT TO file_name OF DEL stmtfile_name is the name of the file to write the data to. stmt is the SELECT statement to select the data to export. For example, to export all data from the table named mytable to a file named myfile.txt, type:
EXPORT TO myfile.txt OF DEL SELECT * FROM mytable
Importing and exporting data on Palm OS mobile devices
DB2 Everyplace for Palm OS uses a set of command line tools for Windows and a Palm OS application to import and export data as PDB files.
The Import/Export tools include the following executable files, which are installed on the Windows workstation. These files are located in DB2Everyplace\Clients\utilities:
The Import/Export tools include the following Palm OS application:
To import data to the Palm OS device:
Table 202 lists the supported data types and their representation in
the CSV file.
Data type | Represented as |
---|---|
integer (or int) | 1234 |
smallint | 1234 |
decimal(n,p) | 12.34 |
char(n) | "John" |
varchar(n) | "John" |
date | yyyymmdd |
time | "14.05.48" |
timestamp | "2001-05-01-16.16.51.000000" |
To represent a null value for a column, enter nothing between the commas of the CSV file. For example, three integer columns with a null in the second column would be represented as 1,,3 in the CSV file and become 1, null, 3 in the database.
PalmImport.bat path_name file_name
where path_name is the path to the CSV file, and file_name is the CSV file name in uppercase without an extension. The CSV file name cannot be enclosed in double quotation marks or contain any blank spaces. For example:
PalmImport.bat DemoImport VNPERSON
The imported tables are automatically added to the Palm Install Tool to be installed after the next HotSync operation.
To export data from the Palm OS device:
PalmDir\user_name\Backup
where PalmDir is the directory where the Palm OS software is installed, and user_name is the user name of the Palm OS user.
PalmExport.bat path_name file_name
where path_name is the output path, and file_name is the DB2 Everyplace table name in uppercase. The DB2 Everyplace table name cannot be enclosed in double quotation marks or contain any blank spaces. For example:
PalmExport.bat DemoExport VNPERSON
The resulting file is in the same path as the source file.
When an error is encountered, the Import/Export tools reports the number of records processed.
A sample using the Import/Export tools is included in the DB2Everyplace\Clients\utilities directory. The batch files PalmExport.bat and PalmImport.bat provide examples of how to use the CSV2DB2e.exe and DB2e2CSV.exe tools.
Related concepts
Related reference