在 Z/OS 上的 db2 的 JDBC URL 中设置默认表空间?

发布于 2024-09-24 12:07:39 字数 409 浏览 2 评论 0原文

是否可以通过向 JDBC URL 传递参数来强制所有创建表语句使用特定的database.tablespace?例如,

CREATE TABLE Message (id INTEGER NOT NULL, created TIMESTAMP, message VARCHAR(255),PRIMARY KEY (id))     in DATABASE.TABLESPACE

我不想按如下方式手动指定它,而是想在连接 URL 中指定“database.tablespace”并执行

CREATE TABLE Message (id INTEGER NOT NULL, created TIMESTAMP, message VARCHAR(255), PRIMARY KEY (id))

Is it possible to force all create table statements to use a specific database.tablespace by passing a parameter to the JDBC URL? For example instead of manually specifying it as follows

CREATE TABLE Message (id INTEGER NOT NULL, created TIMESTAMP, message VARCHAR(255),PRIMARY KEY (id))     in DATABASE.TABLESPACE

I'd like to specify "database.tablespace" in the connection URL and execute

CREATE TABLE Message (id INTEGER NOT NULL, created TIMESTAMP, message VARCHAR(255), PRIMARY KEY (id))

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

停滞 2024-10-01 12:07:39

DB2 完全缺乏您需要的概念。它将用户有权访问的第一个表空间作为“默认”处理:

IF table space IBMDEFAULTGROUP (over which the user
  has USE privilege) exists with sufficient page size
    THEN choose it
ELSE IF a table space (over which the user has USE privilege)
  exists with sufficient page size (see below when
  multiple table spaces qualify)
    THEN choose it
ELSE return an error (SQLSTATE 42727) 

因此,实现您所需要的方法是从除一个表空间之外的所有表空间中删除访问权限,即。

-- repeat for all tablespaces
revoke use of tablespace myspace1 from public
revoke use of tablespace myspace1 from user/group xxx
-- and make sure the ones you really need have access rights
grant use of tablespace myspace1 to user creatoruser

当然,这需要你很好地计划你的行动,但这种方法是有效的。

DB2 lacks entirely the concept you require. It handles the first tablespace the user has access rights to as "the default":

IF table space IBMDEFAULTGROUP (over which the user
  has USE privilege) exists with sufficient page size
    THEN choose it
ELSE IF a table space (over which the user has USE privilege)
  exists with sufficient page size (see below when
  multiple table spaces qualify)
    THEN choose it
ELSE return an error (SQLSTATE 42727) 

Thus the way to achieve what you require is to remove access privileges from all but one tablespace, ie.

-- repeat for all tablespaces
revoke use of tablespace myspace1 from public
revoke use of tablespace myspace1 from user/group xxx
-- and make sure the ones you really need have access rights
grant use of tablespace myspace1 to user creatoruser

Naturally this requires that you plan your actions well, but the approach works.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文