Monday, May 20, 2013

Working with Regsiter Tables

To register a table with REGISTER TABLE DQL please follow these steps:
1.     Connect to DBMS with the proper user. The user connects to the underlying Oracle with Docbase owner account which is found in the server.ini file. Therefore the table can be created in the same tablespace as Docbase:
$> sqlplus
mydocbase/password@conectionString
2.     Create a table as required, and populate it:
SQL>  create table regitest (name char(32), nation char(32), hobby char(32) );
SQL>  insert into regitest values ('Jane', 'Russia', 'Bush Walking');
3.     In Content Server, start a IDQL as dmadmin.
4.     Register the table in IDQL:
DQL> register table dbo.regitest (name char(32), nation char(32), hobby char(32) )
DQL> go
1900040f80002d7c
This dm_registered object represents the underlying table.
Note: It is important to use dbo.regitest instead of just the table name alone. If the table is registered with the table name alone, table_owner is set into session user (here it is dmadmin) into dm_registered object. Afterwards, you will not be able to modify it anymore (refer to solution esg113993 for detail).
5.     Assign proper permission to handle the table, such as:
DQL> update dm_registered object set world_table_permit =15  where object_name = 'regitest'
DQL> update dm_registered object set group_table_permit =15  where object_name = 'regitest'
DQL> update dm_registered object set owner_table_permit =15  where object_name = 'regitest'
6.     Now you can select a row from the underlying table with DQL:
DQL> select name, hobby from dbo.regitest
DQL> go
And you can also insert rows into underlying table with DQL:
DQL> insert into dm_dbo.regtest values ('Jack', 'USA', 'Black Jack')
DQL> go

No comments:

Post a Comment