4.2.4. Create database scheme and users for ERP (exemplified by MSSQL)

In the following the creation of the database scheme and the user "erpuser" is explained:[61]

  1. Configuration of the SQL-Server Connection

  2. Create the Database: Right-click ‘Databases’ -> ‘New Database’

  3. -> The dialog box New database opens. Enter the desired Database name and click on „Add“ and then on OK.

  4. Select the created database and click on New Query.

  5. Now you need a database script for the creation of the database structure (..\tools\databases\MSSQL\erp_install_mssql.sql).

    Copy the content into the empty query field using Copy&Paste and in addition, at the beginning, add the following:

    USE [datenbankname]
    GO
    ...

    Click on Execute.

  6. Now open an empty query and create the user "erpuser". You can use the script plinkdb_reuse.sql (under ..\tools\databases\MSSQL) as template.

    [Caution]Caution

    Adjust the database name!

    USE [master]
    GO
    CREATE LOGIN [erpuser] WITH PASSWORD=N'erpuser', CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
    GO
    CREATE DATABASE [plinkdb] ON 
    ( FILENAME = N'<DBFILE>' ),
    ( FILENAME = N'<DBLOGFILE>' )
     FOR ATTACH
    GO
    if not exists (select name from master.sys.databases sd where name = N'plinkdb' and 
     SUSER_SNAME(sd.owner_sid) = SUSER_SNAME() ) 
     EXEC [plinkdb].dbo.sp_changedbowner @loginame=N'sa', @map=false
    GO
    USE [plinkdb]
    GO
    DROP USER [erpuser]
    GO
    CREATE USER [erpuser] FOR LOGIN [erpuser] WITH DEFAULT_SCHEMA=[dbo]
    GO

    Click on Execute.

    -> Now the database tables and users should be available.

  7. Finally you have to allocate the desired rights for the user "erpuser": Right-click on „erpuser“ -> "Properties".

  8. In the dialog box "Database User - <user_name>" define the desired memberships for the respective user and finally confirm with OK.




[61] Here exemplified by MSSQL Use the provided script for your database type (see Section 4.2.4.1, “Installation scripts ”) and adjust it accordingly.