As an Appway Administrator, I need to set up (or request to a Database administrator) a Database user which can be set in the configuration of the Data Source used by the Business Data Storage. Which steps do I need to take?
To set up a Database user to be used by the Business Data Storage, you need to perform the following steps directly on the Database (outside of Appway):
- Create a new Database user.
- Give to the user the necessary grants for the Business Data Storage.
Consider that
PostgreSQL,
Oracle, and
Microsoft SQL Server are
currently supported. See the sections below for detailed steps for each of them.
Follow these steps:
-
Create a new database user:
CREATE USER data_team_user WITH
LOGIN
NOSUPERUSER
NOCREATEDB
NOCREATEROLE
NOINHERIT
NOREPLICATION
CONNECTION LIMIT -1
PASSWORD 'data_team_pwd';
CREATE SCHEMA data_team_schema
AUTHORIZATION postgres;
where postgres is the admin user considered.
Note that the user (and schema) name used in the script above is just an example, any user (and schema) name allowed by PostgreSQL can be used.
-
Set BDS grants:
GRANT CREATE, USAGE ON SCHEMA data_team_schema TO data_team_user;
GRANT USAGE ON ALL SEQUENCES IN SCHEMA data_team_schema to data_team_user;
These also include grants needed for the username logging feature (see the Securing and Auditing the Data Handled by the Business Data Storage recipe).
A quoted user is supported by the BDS.
Follow these steps:
-
Create a new database user:
ALTER SESSION SET "_ORACLE_SCRIPT" = true;
CREATE USER data_team_user IDENTIFIED BY data_team_pwd
ALTER USER data_team_user QUOTA unlimited ON USERS;
Note that:
- The user name has to be the same as the schema name defined in the Data Source.
- The user name used in the script above is just an example, any user name allowed by Oracle can be used.
- A quoted user name is not supported by the BDS.
-
Set BDS grants:
GRANT CREATE SESSION TO data_team_user;
GRANT CREATE TABLE TO data_team_user;
GRANT CREATE SEQUENCE TO data_team_user;
-
Set username logging related grants. These grants are needed for the username logging feature (see the Securing and Auditing the Data Handled by the Business Data Storage recipe).
GRANT CREATE ANY CONTEXT to data_team_user;
GRANT EXECUTE ON SYS.DBMS_SESSION TO data_team_user;
GRANT CREATE PROCEDURE TO data_team_user;
Follow these steps:
-
Create a new database user:
CREATE DATABASE DataTeamDatabase
USE DataTeamDatabase
CREATE LOGIN DataTeamUser
WITH PASSWORD = 'YourStrong!Passw0rd',
DEFAULT_DATABASE = DataTeamDatabase;
CREATE SCHEMA DataTeamSchema
CREATE USER DataTeamUser FOR LOGIN DataTeamUser WITH DEFAULT_SCHEMA = DataTeamSchema
Note that the user name used in the script above is an example: any user name allowed by Ms SQL Server can be used. If a quoted user name is used, the quotes must also be used in the Appway Data Source configuration. A quoted user is supported by the BDS.
-
Set BDS grants:
GRANT CONNECT TO DataTeamUser
ALTER ROLE db_datareader add member DataTeamUser
ALTER ROLE db_datawriter add member DataTeamUser
ALTER ROLE db_ddladmin add member DataTeamUser
USE MASTER
GRANT VIEW ANY DEFINITION TO DataTeamUser