本文介绍了如何创建德比用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过schema.xml设置数据库模式名称,但是它在ID生成器的生成SQL语句中导致模式名称重复。 ()

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.

但是我不知道如何创建新的Derby用户并将其链接到所需的模式。有人可以帮我吗?

But I don't know how can I create a new Derby user and link it with the desired schema. Can somebody help me?

环境:NetBeans,Glassfish,Derby

Environment: NetBeans, Glassfish, Derby

我已经找到了:

CALL SYSCS_UTIL.SYSCS_CREATE_USER('username', 'password')

但是Derby回答:

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.

或者,如果我尝试通过GUI工具分派此命令,Derby会说:

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


推荐答案

在Derby中创建用户:
我正在使用命令行界面,并且已经设置了系统环境变量到德比。
否则,您可以将这些命令写入CLI

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

java -jar %DERBY_HOME%\lib\derbyrun.jar ij

,然后按Enter键以运行ij工具,您将看到如下提示:

and hit Enter key to run ij tool, and you will see a prompt like this:

ij>

现在键入以下命令来创建用户(将sam替换为所需的用户名,并将sampass替换为所需的用户名密码):

Now type the following command to create a user (replace sam by the desired username and sampass by the desired password):

CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.user.sam','sampass');

现在按回车。这应该显示以下消息:

Now hit enter. This should give a message like this:

0 rows inserted/updated/deleted.

这篇关于如何创建德比用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 02:15