data_henrik
data_henrik

Reputation: 17176

Db2 (Warehouse) on Cloud: How to use APIKEY or ACCESSTOKEN to connect from CLP?

I have an instance of Db2 on IBM Cloud. I would like to use my local CLP to connect to it. I set everything up to be able to connect using a username and password. Now, however, I would like to make use of either an APIKEY or ACCESSTOKEN as documented.

My attempts result in either

SQL30082N Security processing failed with reason "25" ("CONNECTION DISALLOWED"). SQLSTATE=08001

or

SQL30082N Security processing failed with reason "24" ("USERNAME AND/OR PASSWORD INVALID"). SQLSTATE=08001

I have successfully create an APIKEY and also was able to generate an access token using that API key. But what is needed to connect?

connect to clouddb ACCESSTOKEN "my long token here"

Upvotes: 1

Views: 624

Answers (1)

data_henrik
data_henrik

Reputation: 17176

It was a matter of the right setup and correct steps:

  • IAM support only works with SSL connections
  • for SSL, I had to use the right port number (50001) and keywords (security ssl) when cataloging the node and database
  • my Db2 client required additional setup for GSKit and encryption key database

I wrote up a blog post with all the steps and a collection of error message on how to setup a Db2 client to authenticate using either API key or access token. Basically, it is to catalog the server:

 db2 catalog tcpip node Db2oCfra remote db2host-fra02-xxx.services.eu-de.bluemix.net 
     server 50001 security ssl

Then catalog the database:

 db2 catalog db bludb as fradb at node db2ocfra

Thereafter, connect:

 db2 connect to fradb APIKEY myIBMCloudplatformApiKey

There might be additional steps in order to install GSKit and properly configure SSL support.

Upvotes: 1

Related Questions