Import and export data from DB2 database __ Database

Source: Internet
Author: User
Tags db2

Although the personal feeling DB2 is not good for Oracle, but SOA, bought IBM's things, the database also uses IBM's DB2. Just learned how to import and export data from the tables in the DB2 database, and now record them on the blog, lest we forget them later.

Export : Create a new two blank file Xxx.csv (the output file used to hold the data in the table) and log.csv (for storing the log file) in a directory on the disk.

Example: DB2 table in the database test_table

1 First create a Testtbale folder on the disk, and then create a new two blank CSV file within the folder, which is Testtable.csv (the output file used to store the data in the table) and log.csv (for storing the log files).

2 in the DB2 Control center, open the database table, put the mouse on the table test_table, click the right button to select Export, in the export interface "bound Options" by default.

3-point OK to export data

Import : You need an idea when importing, "Del options" next to "Bound Asscii (Del)" In the Import Options interface, click "Del Options" in its popup Interface, change "column delimiter (Doldel)" to "," that is, comma.

Example: DB2 table in the database test_table

1 on the table test_table, right-click to select Import.

2 on the imported pop-up interface, the "Import files" option selects the file testtable.csv, "message file" option to select the file log.csv

3 Select the bounding asscii (del) point "del option"

4 in the Del options interface, change the column delimiter (Doldel) to "," that is, the comma

5-Point OK to import data

DB2 Database table considerations: Table names and field names in the table their length is limited, probably no more than 30 characters, the capacity of each table in the DB2 is also limited (how much is unclear), so when the table has more fields, The size of the type varchar is required, and if the ID of the table is earned, it is best to choose the bigint type.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.