Configuring from command line tool
Prev | Chapter 32. Prepare the MS SQL Server Database for the Tigase Server | Next

## Configuring from command line tool

Creation of the database and import of schema can be done from command line as well. In order to do that one needs to execute following commands (either from directory where Tigase XMPP Server is installed or paths to the schema need to be adjusted accordingly):

    sqlcmd -S %servername% -U %root_user% -P %root_pass% -Q "CREATE DATABASE [%database%]"
    sqlcmd -S %servername% -U %root_user% -P %root_pass% -Q "CREATE LOGIN [%user%] WITH PASSWORD=N'%password%', DEFAULT_DATABASE=[%database%]"
    sqlcmd -S %servername% -U %root_user% -P %root_pass% -d %database% -Q "ALTER AUTHORIZATION ON DATABASE::%database% TO %user%;"
    sqlcmd -S %servername% -U %root_user% -P %root_pass% -d %database% -i database\sqlserver-schema-5-1-schema.sql
    sqlcmd -S %servername% -U %root_user% -P %root_pass% -d %database% -i database\sqlserver-schema-5-1-sp.sql
    sqlcmd -S %servername% -U %root_user% -P %root_pass% -d %database% -i database\sqlserver-schema-5-1-props.sql

Above can be automatized with provided script %tigase-server%\scripts\db-create-sqlserver.cmd (note: it needs to be executed from main Tigase XMPP Server directory due to maintain correct paths):

    $ scripts\db-create-sqlserver.cmd %database_servername% %database_name% %tigase_username% %tigase_password% %root_username% %root_password%

If no parameters are provided then defaults are used:

    %database_servername%=localhost
    %database_name%=tigasedb
    %tigase_username%=tigase
    %tigase_password%=tigase12
    %root_username%=root
    %root_password%=root

Prev | Up | Next
Import Schema | Home | Tigase configuration - init.properties