I tried to set the DB schema name by schema.xml but it caused a schema name duplication in the generated SQL statement for ID generators. (Duplicate schema name in sequece generation)
I read the schema is defined by the passed user at connection time. Now I would like to set the schema by this way.
But I don't know how can I create a new Derby user and link it with the desired schema. Can somebody help me?
Environment: NetBeans, Glassfish, Derby
I have found this:
CALL SYSCS_UTIL.SYSCS_CREATE_USER('username', 'password')
But Derby answers:
Error code -1, SQL state 42Y03: 'SYSCS_UTIL.SYSCS_CREATE_USER' is not recognized as a function or procedure.
Why? I have connected to the db as the default admin user.
Or if I try to dispatch this command from a GUI tool, Derby says:
[Error Code: 0, SQL State: 42Y07] : Schema 'SYSCS_UTIL' does not exist
here is a solution (heavily commented):
Let me know if that works (or not) for you.
To Create user in Derby : I am using Command Line Interface and I have already set my System environment variable to Derby. Otherwise you can write these command into your CLI
and hit Enter key to run ij tool, and you will see a prompt like this:
Now type the following command to create a user (replace sam by the desired username and sampass by the desired password):
Now hit enter. This should give a message like this: