1

Can someone please explain to me how SYSCS_UTIL.SYSCS_CREATE_USER() works? I tried adding a new user like this: SYSCS_UTIL.SYSCS_CREATE_USER('user', 'someP@ss'), and it gave an exception Error code 30000, SQL state 4251K: The first credentials created must be those of the DBO.

I found the function in the Derby Docs, but it showed the Fred example, which I also tried, but it gave me the same exception.

I created the database via NetBeans.

Johan Brink
  • 111
  • 3

1 Answers1

1

Read the secderby.pdf, page 41, "Configuring NATIVE authentication":

Use the SYSCS_UTIL.SYSCS_CREATE_USER system procedure to add credentials for the Database Owner. Remember that the Database Owner is the user who created the database.

I assume you created your DB without username/password or you tried to create a different user then the one when you created the DB.

Working example:
CONNECT 'jdbc:derby://localhost:1527/myDB;create=true;user=admin;password=admin123'; call SYSCS_UTIL.SYSCS_CREATE_USER('admin', 'admin123' ); You see in the above example the DBO (database owner) is 'admin' and for the very first SYSCS_CREATE_USER call, the user must be 'admin' too.

Not working example:
CONNECT 'jdbc:derby://localhost:1527/myBadDB;create=true;'; call SYSCS_UTIL.SYSCS_CREATE_USER('admin', 'admin123' );

Andreas
  • 11
  • 1