Loading data from IBM Cloud Object Storage
External Tables
You can load data from IBM Cloud Object Storage (COS) into IBM® Db2® Warehouse on Cloud by using the built-in External Tables functionality.
Here's an example SQL statement that inserts COS data into a Db2 Warehouse on Cloud table by using External Tables:
INSERT INTO <table-name> SELECT * FROM EXTERNAL '<mys3file.txt>' USING
(CCSID 1208 s3('s3-api.us-geo.objectstorage.softlayer.net',
'<S3-access-key-ID>',
'<S3-secret-access-key>',
'<my_bucket>'
)
)
For IBM Cloud Object Storage, to create HMAC credentials when creating new service credentials, specify {"HMAC:true"} in the Add Inline Configuration Parameters field.
Db2 LOAD utility
You can also load data from IBM Cloud Object Storage (COS) into Db2 Warehouse on Cloud by using the built-in Db2 LOAD utility.
Here’s an example SQL statement that uses the Db2 LOAD utility to load COS data into Db2 Warehouse on Cloud:
CALL SYSPROC.ADMIN_CMD('LOAD FROM "S3::<cos-endpoint-url>::<cos-access-key-ID>::<cos-secret-access-key>:
:<cos-bucket-name>::<path-to-data-file>" OF <filetype> <additional-load-options> INTO <table-name>)
For more information about the Db2 LOAD utility, see: LOAD command.