Reputation: 2974
I have to try to load data to DB2 WoC (formerly dashDB) from IBM Cloud Object Storage (Softlayer) by using /load_jobs
API call.
Always getting error response: SQL3025N,A parameter specifying a filename or path is not valid.,0,n/a
Trying different formatting for path
key, like following:
us-south/woctestdata/data_example.csv
/woctestdata/data_example.csv
woctestdata/data_example.csv
woctestdata::data_example.csv
also tried folowing suggestions from comments:
us-south::woctestdata\data_example.csv
us-south::woctestdata::data_example.csv
So no more ideas. How the path should be entered correctly?
There is the example of my request:
curl -X POST \
https://dashdb-mpp.services.dal.bluemix.net/dashdb-api/v2/load_jobs \
-H 'Authorization: Bearer <api_key>' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{
"load_source": "SOFTLAYER",
"load_action": "INSERT",
"schema": "MKT_ATBTN",
"table": "TRANSMISSIN_TABLE1",
"max_row_count": 0,
"max_warning_count": 0,
"cloud_source": {
"endpoint": "https://tor01.objectstorage.softlayer.net/auth/v1.0",
"path": "woctestdata/data_example.csv",
"auth_id": "<auth_id>",
"auth_secret": "<auth_secret>"
},
"server_source": {
"file_path": "string"
},
"stream_source": {
"file_name": "string"
},
"file_options": {
"code_page": "1208",
"column_delimiter": ";",
"string_delimiter": "",
"date_format": "YYYY-MM-DD",
"time_format": "HH:MM:SS",
"timestamp_format": "YYYY-MM-DD HH:MM:SS",
"cde_analyze_frequency": 0
}
}'
I also try to use db2 load command to load data from IBM Cloud object storage. But also no luck:
db2 load from Softlayer::https://tor01.objectstorage.softlayer.net/auth/v1.0::IBM:<ibm_email_address>::<password>::woctestdata::data_example.csv of del insert into MKT_ATBTN.TRANSMISSIN_TABLE1;
Result:
Agent Type Node SQL Code Result
_______________________________________________________________________
PRE_PARTITION 000 -00003025 Error.
_______________________________________________________________________
RESULTS: 0 of 0 LOADs completed successfully.
_______________________________________________________________________
Summary of LOAD Agents:
Number of rows read = 0
Number of rows skipped = 0
Number of rows loaded = 0
Number of rows rejected = 0
Number of rows deleted = 0
Number of rows committed = 0
SQL3025N A parameter specifying a filename or path is not valid.
Upvotes: 1
Views: 342
Reputation: 1
you also can use endpoints + object path, the path format is bucketname::filename
Upvotes: -1
Reputation: 1104
To download or access to the file you need to get an X-Auth-Token or set its container with an static URL through the Web page.
I recommend to review Managing the Object Storage and softlayer-object-storage-auth-endpoint
When you run the command
curl -i -H "X-Auth-User: SLOS300001-10:rcuellar" -H "X-Auth-Key: 231222489e90646678364kjsdfhytwterd0259" https://tor01.objectstorage.softlayer.net/auth/v1.0
The response is something like this:
X-Auth-Token: AUTH_tkb26239d441d6401d9482b004d45f7259 – the token we need
X-Storage-Url: https://tor01.objectstorage.softlayer.net/v1/AUTH_df0de35c-d00a-40aa-b697-2b7f1b9331a6
And now you should be able to access to the file with an URL similar like below:
https://tor01.objectstorage.softlayer.net/v1/AUTH_df0de35c-d00a-40aa-b697-2b7f1b9331a6/woctestdata/data_example.csv
In the portal page go to:
Storage >> Object Storage >> Select Object Storage >> Select Cluster (e.g. Toronto) >> Select your container
And check the Enable Static Site checkbox, see image below.
Upvotes: 0