CREATE DATABASE HIG ADD 'diserver' SYSTEM USER PASSWORD Wwx8G8U3tK9nntJS;
SELECT * FROM SYS_DATABASES.M_SERVICES WHERE SERVICE_NAME = 'diserver' AND DATABASE_NAME = 'HIG' AND ACTIVE_STATUS = 'YES';
ALTER DATABASE HIG ADD 'diserver';
--create a user
CREATE USER HDI_ADMIN PASSWORD LF52EHVDwesTYhRx NO FORCE_FIRST_PASSWORD_CHANGE;
-- create a temporary table which contains privileges to assign to the user HDI_ADMIN
CREATE LOCAL TEMPORARY TABLE #PRIVILEGES LIKE _SYS_DI.TT_API_PRIVILEGES;
-- fill the temporary table with the corresponding user and with the values from the table T_DEFAULT_DI_ADMIN_PRIVILEGES
INSERT INTO #PRIVILEGES (PRINCIPAL_NAME, PRIVILEGE_NAME, OBJECT_NAME) SELECT 'HDI_ADMIN', PRIVILEGE_NAME, OBJECT_NAME FROM _SYS_DI.T_DEFAULT_DI_ADMIN_PRIVILEGES;
-- call the procedure to assign the HDI admin privileges to the user HDI_ADMIN
CALL _SYS_DI.GRANT_CONTAINER_GROUP_API_PRIVILEGES('_SYS_DI', #PRIVILEGES, _SYS_DI.T_NO_PARAMETERS, ?, ?, ?);
-- remove the temporary table
DROP TABLE #PRIVILEGES;
Return Code | Meaning | Details |
---|---|---|
0 | Success | The call was successful, and the messages did not report any warnings or errors |
1 | Warning | The messages contain warnings, but no errors. |
-1 | Error | The messages contain errors. |
-2 | Fatal Error | No messages could be logged. This indicates a problem with the database. |
2.) SQL API Return Codes for HDI
-- connect with the HDI Admin
CONNECT HDI_ADMIN PASSWORD LF52EHVDwesTYhRx;
-- call the corresponding procedure to create the container group
CALL _SYS_DI.CREATE_CONTAINER_GROUP('HDI_CG', _SYS_DI.T_NO_PARAMETERS, ?, ?, ?);
-- login with the SYSTEM user to create a new user
CONNECT SYSTEM PASSWORD Wwx8G8U3tK9nntJS;
-- create a user
CREATE USER HDI_CG_ADMIN PASSWORD XTNkqaKpM3D2gfFt NO FORCE_FIRST_PASSWORD_CHANGE;
-- login with HDI_ADMIN to grant the container group privileges to the HDI_CG_ADMIN user
CONNECT HDI_ADMIN PASSWORD LF52EHVDwesTYhRx;
-- create a temporary table which contains privileges to assign to the user HDI_CG_ADMIN
CREATE LOCAL TEMPORARY COLUMN TABLE #PRIVILEGES LIKE _SYS_DI.TT_API_PRIVILEGES;
-- fill the temporary table with the corresponding user and with the values from the table T_DEFAULT_CONTAINER_GROUP_ADMIN_PRIVILEGES
INSERT INTO #PRIVILEGES (PRINCIPAL_NAME, PRIVILEGE_NAME, OBJECT_NAME) SELECT 'HDI_CG_ADMIN', PRIVILEGE_NAME, OBJECT_NAME FROM _SYS_DI.T_DEFAULT_CONTAINER_GROUP_ADMIN_PRIVILEGES;
-- call the procedure to assign the container group admin privileges to the user HDI_CG_ADMIN
CALL _SYS_DI.GRANT_CONTAINER_GROUP_API_PRIVILEGES('HDI_CG', #PRIVILEGES, _SYS_DI.T_NO_PARAMETERS, ?, ?, ?);
-- remove the temporary table
DROP TABLE #PRIVILEGES;
contains the database development artifacts, both design-time and run-time. The HDI container group administrator can create a new container.
-- Connect with the container group admin
CONNECT HDI_CG_ADMIN PASSWORD XTNkqaKpM3D2gfFt;
-- call the corresponding procedure to create the container HDI_C in the container group HDI_CG
CALL _SYS_DI#HDI_CG.CREATE_CONTAINER('HDI_C', _SYS_DI.T_NO_PARAMETERS, ?, ?, ?);
-- login with the SYSTEM user to create a new user
CONNECT SYSTEM PASSWORD Wwx8G8U3tK9nntJS;
-- create the HDI_C_ADMIN user
CREATE USER HDI_C_ADMIN PASSWORD MvfNa7JfqRFP4U5a NO FORCE_FIRST_PASSWORD_CHANGE;
-- login with HDI_CG_ADMIN to grant the container admin privileges to the HDI_C_ADMIN user
CONNECT HDI_CG_ADMIN PASSWORD XTNkqaKpM3D2gfFt;
-- create a temporary table which contains privileges to assign to the user HDI_C_ADMIN
CREATE LOCAL TEMPORARY COLUMN TABLE #PRIVILEGES LIKE _SYS_DI.TT_API_PRIVILEGES;
-- fill the temporary table with the corresponding user and with the values from the table T_DEFAULT_CONTAINER_ADMIN_PRIVILEGES
INSERT INTO #PRIVILEGES (PRINCIPAL_NAME, PRIVILEGE_NAME, OBJECT_NAME) SELECT 'HDI_C_ADMIN', PRIVILEGE_NAME, OBJECT_NAME FROM _SYS_DI.T_DEFAULT_CONTAINER_ADMIN_PRIVILEGES;
-- call the procedure to assign the container administrator privileges to the user HDI_C_ADMIN
CALL _SYS_DI#HDI_CG.GRANT_CONTAINER_API_PRIVILEGES('HDI_C', #PRIVILEGES, _SYS_DI.T_NO_PARAMETERS, ?, ?, ?);
-- remove the temporary table
DROP TABLE #PRIVILEGES;
-- connect with the container admin user
CONNECT HDI_C_ADMIN PASSWORD MvfNa7JfqRFP4U5a;
-- call the corresponding procedure to configure the plug-in libraries
CALL HDI_C#DI.CONFIGURE_LIBRARIES(_SYS_DI.T_DEFAULT_LIBRARIES, _SYS_DI.T_NO_PARAMETERS, ?, ?, ?);
CALL HDI_C#DI.LIST_CONFIGURED_LIBRARIES(_SYS_DI.T_NO_PARAMETERS, ?, ?, ?, ?)
-- login with the SYSTEM user to create a new user
CONNECT SYSTEM PASSWORD Wwx8G8U3tK9nntJS;
-- create HDI_C_DEV user
CREATE USER HDI_C_DEV PASSWORD Lgb8PgUzaqC7TZSC NO FORCE_FIRST_PASSWORD_CHANGE;
-- login with HDI_C_ADMIN as container admin
CONNECT HDI_C_ADMIN PASSWORD MvfNa7JfqRFP4U5a;
-- create a temporary table which contains privileges to assign to the user HDI_C_DEV
CREATE LOCAL TEMPORARY COLUMN TABLE #PRIVILEGES LIKE _SYS_DI.TT_API_PRIVILEGES;
-- fill the temporary table with the corresponding user and with the values from the table T_DEFAULT_CONTAINER_USER_PRIVILEGES
INSERT INTO #PRIVILEGES (PRINCIPAL_NAME, PRIVILEGE_NAME, OBJECT_NAME) SELECT 'HDI_C_DEV', PRIVILEGE_NAME, OBJECT_NAME FROM _SYS_DI.T_DEFAULT_CONTAINER_USER_PRIVILEGES;
-- call the procedure to assign the container developer privileges to the user HDI_C_DEV
CALL HDI_C#DI.GRANT_CONTAINER_API_PRIVILEGES(#PRIVILEGES, _SYS_DI.T_NO_PARAMETERS, ?, ?, ?);
-- remove the temporary table
DROP TABLE #PRIVILEGES;
-- connect with the HDI container developer user HDI_C_DEV
CONNECT HDI_C_DEV PASSWORD Lgb8PgUzaqC7TZSC;
-- create a temporary table which contains the design-time objects definitions
CREATE LOCAL TEMPORARY COLUMN TABLE #PATHS LIKE _SYS_DI.TT_FILESFOLDERS_CONTENT;
-- list the plug-ins in .hdiconfig which are used in the project
INSERT INTO #PATHS (PATH, CONTENT) VALUES ('.hdiconfig', '{ "plugin_version" : "2.0.30.0", "file_suffixes" : { "hdbtable" : { "plugin_name" : "com.sap.hana.di.table" }, "hdbview" : { "plugin_name" : "com.sap.hana.di.view" } } }');
-- configure the namespace structure in .hdinamespace
INSERT INTO #PATHS (PATH, CONTENT) VALUES ('.hdinamespace', '{ "name": "", "subfolder": "ignore" }');
-- create the src folder
INSERT INTO #PATHS (PATH, CONTENT) VALUES ('src/', NULL);
-- create a file named t.hdbtable which contains a table definition
INSERT INTO #PATHS (PATH, CONTENT) VALUES ('src/t.hdbtable', 'COLUMN TABLE T ( A INTEGER )');
-- create a file named v.hdbview which contains a view definition
INSERT INTO #PATHS (PATH, CONTENT) VALUES ('src/v.hdbview', 'VIEW V AS SELECT A FROM T');
-- write the files or folders in the container's work file system
CALL HDI_C#DI.WRITE(#PATHS, _SYS_DI.T_NO_PARAMETERS, ?, ?, ?);
-- remove the temporary table
DROP TABLE #PATHS;
-- connect with the HDI container developer user HDI_C_DEV
CONNECT HDI_C_DEV PASSWORD Lgb8PgUzaqC7TZSC;
-- create a temporary table which contains the corrospending parameters
CREATE LOCAL TEMPORARY COLUMN TABLE #PARAMETERS LIKE _SYS_DI.TT_PARAMETERS;
-- insert recursive, true to display the files also in the subfolders
INSERT INTO #PARAMETERS ( KEY, VALUE ) VALUES ('recursive', 'true');
-- call the procedure with the PARAMETERS
CALL HDI_C#DI.LIST(_SYS_DI.T_NO_FILESFOLDERS, #PARAMETERS, ?, ?, ?, ?);
-- remove the temporary table
DROP TABLE #PARAMETERS;
-- connect with the HDI container developer user HDI_C_DEV
CONNECT HDI_C_DEV PASSWORD Lgb8PgUzaqC7TZSC;
-- create a temporary table which contains a list of desing-time objects
CREATE LOCAL TEMPORARY COLUMN TABLE #DEPLOY_PATHS LIKE _SYS_DI.TT_FILESFOLDERS;
-- insert the path of the desing-time objects
INSERT INTO #DEPLOY_PATHS (PATH) VALUES ('.hdiconfig');
INSERT INTO #DEPLOY_PATHS (PATH) VALUES ('.hdinamespace');
INSERT INTO #DEPLOY_PATHS (PATH) VALUES ('src/t.hdbtable');
INSERT INTO #DEPLOY_PATHS (PATH) VALUES ('src/v.hdbview');
-- in case to undeploy objects
CREATE LOCAL TEMPORARY COLUMN TABLE #UNDEPLOY_PATHS LIKE _SYS_DI.TT_FILESFOLDERS;
-- in case to pass some parameters
CREATE LOCAL TEMPORARY COLUMN TABLE #PATH_PARAMETERS LIKE _SYS_DI.TT_FILESFOLDERS_PARAMETERS;
-- call the procedure to generate the run-time objects
CALL HDI_C#DI.MAKE(#DEPLOY_PATHS, #UNDEPLOY_PATHS, #PATH_PARAMETERS, _SYS_DI.T_NO_PARAMETERS, ?, ?, ?);
-- remove the temporary tables
DROP TABLE #DEPLOY_PATHS;
DROP TABLE #UNDEPLOY_PATHS;
DROP TABLE #PATH_PARAMETERS;
-- login with the SYSTEM user to create a new user
CONNECT SYSTEM PASSWORD Wwx8G8U3tK9nntJS;
-- create the HDI_C_CONSUMER user
CREATE USER HDI_C_CONSUMER PASSWORD RU7AeXTFGdsRxz2q NO FORCE_FIRST_PASSWORD_CHANGE;
-- connect with the container admin user
CONNECT HDI_C_ADMIN PASSWORD MvfNa7JfqRFP4U5a;
-- create a temporary table which contains privileges to assign to the user HDI_C_CONSUMER
CREATE LOCAL TEMPORARY COLUMN TABLE #PRIVILEGES LIKE _SYS_DI.TT_SCHEMA_PRIVILEGES;
-- fill the temporary table with the corresponding user and privileges to assign
INSERT INTO #PRIVILEGES ( PRIVILEGE_NAME, PRINCIPAL_SCHEMA_NAME, PRINCIPAL_NAME ) VALUES ( 'SELECT', '', 'HDI_C_CONSUMER' );
-- call the procedure to assign the privileges to the user HDI_C_CONSUMER
CALL HDI_C#DI.GRANT_CONTAINER_SCHEMA_PRIVILEGES( #PRIVILEGES, _SYS_DI.T_NO_PARAMETERS, ?, ?, ?);
-- remove the temporary table
DROP TABLE #PRIVILEGES;
-- connect with the consumer user
CONNECT HDI_C_CONSUMER PASSWORD RU7AeXTFGdsRxz2q;
-- access to the table T in the container HDI_C
SELECT * FROM HDI_C.T;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
40 | |
25 | |
17 | |
14 | |
8 | |
7 | |
7 | |
7 | |
6 | |
6 |