Skip to content
Advertisement

Create database user with DDL in DB2

I am trying to create a user using DDL in DB2. I tried this:

CREATE USER 'test_user' IDENTIFIED BY 'password';

and I got this error message:

An unexpected token "'test_user' 
IDENTIFIED BY 'password'" was found following "CREATE USER ".  Expected tokens may include:  "<space>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.24.92

when I remove the apostrophes:

CREATE USER test_user IDENTIFIED BY password

I get this:

An unexpected token "USER" was found following "CREATE ".  Expected tokens may include:  "VARIABLE".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.24.92

I have full admin rights and I am running DB2 Warehouse on Cloud Type:Enterprise Plan – Single Node

Advertisement

Answer

When you take a look at SQL statements supported by Db2 Warehouse on Cloud, you will notice that there is no CREATE USER statement. Hence the error message.

Check out the section on user management or see the API to create a new user.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement