copyright | lastupdated | keywords | subcollection | ||
---|---|---|---|---|---|
|
2023-07-12 |
Db2onCloud |
{:external: target="_blank" .external} {:shortdesc: .shortdesc} {:codeblock: .codeblock} {:screen: .screen} {:tip: .tip} {:important: .important} {:note: .note} {:deprecated: .deprecated} {:pre: .pre}
{: #loading}
{: #console}
You can load data from IBM Cloud Object Storage (COS) into IBM® Db2® as a Service by using the Console.
{: #bucket}
- Access the COS Bucket on the IBM Cloud Dashboard by clicking on the name
{: caption="Figure 1. Resource List" caption-side="bottom"}
- Select
Service Credentials
- Click on
New Credentials
- Enter
Name
for the Service Credential - Select the appropriate role
- Ensure
Include HMAC Credential
is enabled
{: caption="Figure 2. Create Service Credentials" caption-side="bottom"}
- Expand the Credential
- Note down the
access_key_id
andsecret_access_key
{: caption="Figure 3. Get Access Keys" caption-side="bottom"}
- Click on
Data
on the left menu - Click on
Load Data
on the top tab - Click on
Cloud Object Storage
- Pick the
COS Authentication Endpoint
that matches your bucket - Enter the
access_key_id
from above forAccess key
- Enter the
secret_access_key
from above forSecret access key
- Click on
Browse Files
to select the file you want to load from
{: caption="Figure 4. Load COS Data" caption-side="bottom"}
{: #external}
You can load data from IBM Cloud Object Storage (COS) into IBM® Db2® as a Service by using the built-in External Tables functionality.
Here's an example SQL statement that inserts COS data into a {{site.data.keyword.dashdbshort_notm}} 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>'
)
)