data_henrik
data_henrik

Reputation: 17118

Db2 Warehouse (on Cloud): How to create external table?

Per the "What's new in Db2 Warehouse on Cloud, ..." it is possible to create external tables. I looked at the linked documentation at the syntax on how to create such an external table to link to my Amazon S3 and my IBM Bluemix / Softlayer Swift Cloud Object Storage. I have a Db2 Warehouse on Cloud with an "Entry Plan" and I don't see any restrictions mentioned.

CREATE EXTERNAL TABLE exttab1(a int,s varchar(50)) using
  (dataobject 'testdata.csv'
   swift('https://fra02.objectstorage.softlayer.net/auth/v1.0/',
    'IBMOS12345:userid',
    '5---MyFullAPIKeyHere---b983',
    'henrik'
   )
  )

The above SQL statement gives me:

SQL0104N: database/sql/driver: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "EXTERNAL" was found following "CREATE". Expected tokens may include: "". SQLSTATE=42601

What is the correct syntax? Are there restrictions I am not aware of?

Upvotes: 0

Views: 837

Answers (1)

data_henrik
data_henrik

Reputation: 17118

The syntax and everything else was correct. I found out that my instance was not on the latest code level. The documentation was ahead of my cloud environment. I am now able to create the above external table and SELECT from it using SQL.

Upvotes: 0

Related Questions