Create Database Users and Storage in Non-DBO Schemas for SQL Server

About this task

If you are going to create IBM database components in a SQL Server RDBMS, you can create them in non-dbo schemas if necessary. To do so, use SQL Server Studio rather than the Database Component Configurator to create the database, database user, and storage, and then use the Database Component Configurator to create the database components.

Procedure

  1. Create the database using SQL Server Studio.
  2. Connect to the master database and then create a login for the new database as follows:
    CREATE LOGIN login_name WITH PASSWORD = 'password'
  3. Run this command to make the new database the default database:
    ALTER LOGIN login_name WITH DEFAULT_DATABASE = database_name
  4. Connect to the database and then run the SQL statements below:
    CREATE USER user_name FOR LOGIN login_name
    CREATE SCHEMA schema_name
    ALTER AUTHORIZATION ON SCHEMA::schema_name TO user_name
    ALTER USER user_name WITH DEFAULT_SCHEMA=schema_name
    execute sp_addrolemember N'db_datareader', user_name
    execute sp_addrolemember N'db_datawriter', user_name
    execute sp_addrolemember N'db_ddladmin', user_name