【问题标题】:Set default tablespace in JDBC URL for db2 on Z/OS?在 Z/OS 上的 db2 的 JDBC URL 中设置默认表空间?
【发布时间】:2010-09-20 15:02:11
【问题描述】:

是否可以通过将参数传递给 JDBC URL 来强制所有 create table 语句使用特定的 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))

【问题讨论】:

    标签: jdbc db2 mainframe zos


    【解决方案1】:

    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
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-09
      • 2019-06-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多