Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create db2 schema using jdbc

What is the correct syntax or what are the correct steps for creating a schema in DB2 using JDBC?

When running create schema test1 or create schema test1 authorization db2admin as db2admin, I consistently get DB2 SQL Error: SQLCODE=-552, SQLSTATE=42502, SQLERRMC=DB2ADMIN;CREATE SCHEMA, DRIVER=3.64.106

The exact same command works fine using the DB2 command-line tools.

like image 227
Axel Fontaine Avatar asked Dec 21 '12 15:12

Axel Fontaine


1 Answers

I found it.

It turns out that for some reason DB2 Express-C does not grant the DBADM privilege to db2admin by default.

This can be fixed by connecting to the DB and then issuing

GRANT DBADM ON DATABASE to db2admin

Thanks Ian Bjorhovde for providing the inspiration spark!

like image 111
Axel Fontaine Avatar answered Oct 16 '22 06:10

Axel Fontaine