Preconfiguring SQL Server Manually

Prepare your Microsoft SQL Server database before using the 3DOrchestrate deployment utility.

This task shows you how to:


Before you begin: Enable XA transactions. For more information, see Enabling XA Transactions in Windows SQL Server Database.

Use the In-doubt xact resolution option to control the default outcome of transactions that the Microsoft Distributed Transaction Coordinator (MS DTC) is unable to resolve. The MSDTC down time or an unknown transaction outcome at the time of recovery might cause an inability to resolve transactions. The following table lists the possible outcome values for resolving an in-doubt transaction.

Outcome value Description
0 No presumption. Recovery fails if MS DTC cannot resolve any in-doubt transactions.
1 Presume commit. The MS DTC presumes that any MS DTC in-doubt transactions have committed.
2 Presume abort. The MS DTC presumes that any MS DTC in-doubt transactions have ended.

To minimize the possibility of extended down time, an administrator might choose to configure this option either to presume commit or presume abort, as shown in the example above.

Create the Database

  1. Start the Microsoft SQL Server Management Studio. Connect to the studio application with the administrative account sa.
  2. Click New Query on the toolbar.
  3. Copy the SQL code below, and paste it into the new query window.

    USE [master];
    GO
    
    CREATE DATABASE [<db_name>]
    ON PRIMARY (
        NAME = '<db_name>',
        FILENAME = '<db_path>\<db_name>.mdf',
        SIZE = 1GB,
        FILEGROWTH = 50%
    )
    LOG ON (
        NAME = '<db_name>_LOG',
        FILENAME ='<db_path>\<db_name>_LOG.ldf',
        SIZE = 10MB,
        FILEGROWTH = 25%
    );
    GO
    
    ALTER DATABASE [<db_name>] SET READ_COMMITTED_SNAPSHOT ON;
    ALTER DATABASE [<db_name>] SET ALLOW_SNAPSHOT_ISOLATION ON;
    GO

    In this code, specify values for the following:

    <db_name>
    Name for the 3DOrchestrate database; for example, 3Dorchdb.
    <db_path>
    Folder location in which to install the database; for example, C:\3DExp_db.

  4. Click Execute on the toolbar.

Create the Database User and Grant User Access

  1. Continue working as the administrative user sa in Microsoft SQL Server Management Studio.
  2. Run the following SQL code to create a new database user account for 3DOrchestrate.

    USE [master];
    GO
    
    CREATE LOGIN <db_login>
        WITH PASSWORD    = '<db_password>',
        CHECK_POLICY     = OFF,
        CHECK_EXPIRATION = OFF,
        DEFAULT_DATABASE = [<db_name>];
    GO
    
    USE [<db_name>];  
    GO  
    
    CREATE USER [<db_login>] FOR LOGIN [<db_login>];  
    GO 
    
    GRANT CREATE TABLE,
          ALTER,
          REFERENCES,
          SELECT,
          INSERT,
          UPDATE,
          DELETE
    ON DATABASE::<db_name> TO <db_login>;
    GO

    In this code, specify values for the following:

    <db_name>
    Name of the 3DOrchestrate database you recently created.
    <db_login>
    Login name for the new user account.
    <db_password>
    Password for the new user account.

    Notes:
    • The user script does not grant database administrator (DBA) permissions to the user account.
    • In SQL Server, you must create a LOGIN first, then a USER; they are two different entities with different purposes.
    • The CREATE DATABASE statement purposely omits any COLLATION option, so it picks up the default collation specified during the SQL Server installation.
    • All string literals surrounded by simple quotes use the default character encoding scheme. To force SQL Server to use Unicode for these string literals, prepend the N prefix as explained in the following Microsoft support article:

      https://support.microsoft.com/en-us/kb/239530

      For example,

      NAME = '<db_name>'

      becomes

      NAME = N'<db_name>'

  3. Do the following to enable XA transactions:
    1. From the Start menu, run dcomcnfg to open the Component Services dialog box.
    2. In the Component Services tree, expand Computers > My Computer > Distributed Transaction Coordinator > Local DTC, and then right-click Local DTC and select Properties.
    3. In the Local DTC Properties dialog box, click the Security tab, and then select Enable XA Transactions.
    4. Click OK to close the Local DTC Properties dialog box.
  4. Do the following to install and grant XA transaction rights to the new database user account:
    1. Run the following SQL statements:

      EXEC sp_sqljdbc_xa_install;
      USE master
      GO
      EXEC sp_grantdbaccess [ @db_login ], [ @name_in_db ];
      EXEC sp_addrolemember [SqlJDBCXAUser], [db_login];
      GO 

      Where,

      • [ @db_login ] is the name of the Windows group, Windows login, or SQL Server login that you want to map to the new database user. Names of Windows groups and Windows login must be qualified with a Windows domain name in Domain\login format; for example, LONDON\Joeb. You cannot map the login to a user that is already in the database. login is a sysname with no default value.
        Note: If [@db_login] already exists, do not include [@name_in_db] in the command, instead use the following command:
        
        EXEC sp_sqljdbc_xa_install;
        USE master
        GO
        EXEC sp_grantdbaccess [ db_login ]; 
        EXEC sp_addrolemember [SqlJDBCXAUser], [db_login];
        GO 
      • [ @name_in_db ] is the name of the new database user. name_in_db is an OUTPUT variable with a data type of sysname and a default value of NULL. If not specified, login is used. If specified as an OUTPUT variable, @name_in_db is set to login. name_in_db must not already exist in the database.

    2. When the SQL statements run to completion, search for the following error messages in the Catalina logs:

      [main] org.apache.geronimo.transaction.manager.TransactionImpl.enlistResource Unable to enlist XAResource  XAResourceID:1, errorCode: -3
      javax.transaction.xa.XAException: com.microsoft.sqlserver.jdbc.SQLServerException: Failed to create the XA control connection. 

    If the errors are present, rerun the sp_sqljdbc_xa_install and sp_addrolemember SQL statements.

Create the Database Tables for the 3DOrchestrate Application

If you selected the Standard or High Availability deployment, you can skip this section; for those deployments, the 3DOrchestrate installer creates the appropriate database tables automatically. If you selected a different deployment option, follow the instructions in this section to configure the Microsoft SQL Server manually for use with the 3DOrchestrate Distribution Server.

Microsoft SQL Management Studio methodology:

  1. Use the database login and password that you created above to connect to the database using the Microsoft SQL Server Management Studio console.

  2. From the Available Databases list on the toolbar, select the newly created database (<db_name>).

  3. Use the open file command and find the createtables.sql script in the 3DOrchestrate Distribution Server installation:

    <server_install_dir>\win_b64\reffiles\SMAExeServer\database\mssql\createtables.sql
  4. Click Open to execute this script.

    Execute the createtables.sql script with the 3DOrchestrate user login that you defined (<db_login>). Do not execute this script as the sa user account or any other administrative user.

Microsoft sqlcmd utility methodology:

  1. Use the database login and password that you created above along with the database name as command-line arguments for sqlcmd.

  2. Append the –I option to the createtables.sql script to enable quoted identifiers. For example:

    ./sqlcmd -d test -U testUSER -P 'testUSER' -i 
        /a/COS/linux_a64/reffiles/SMAExeServer/database/mssql/createtables.sql -I

Open TCP Connections on Port 1433

The 3DOrchestrate Distribution Server application communicates with the SQL Server database through port 1433.

  1. Start the Microsoft SQL Server Configuration Manager.
  2. Select SQL Server Network Configuration > Protocols for SQLSERVER2012 in the left-hand pane.
  3. Right-click on TCP/IP in the right-hand pane and select Properties.
  4. Under the Protocol tab, set Enabled to Yes.
  5. Under the IP Addresses tab, scroll down to find the IPAll properties.

    Set the TCP Port to 1433.

  6. Restart the SQL Server database.

Deploy the Application

  1. Start the deployment utility GUI from the command line by executing the following batch file:

    <server_install_dir>\win_b64\reffiles\SMAExeServer\deploy\smaexe-deploy.bat

  2. In the General Settings tab, choose MSSQL Preconfigured as the database type.
  3. Switch to the MSSQL Settings Preconfigured tab and enter all required information. The MSSQL Connect Port should be 1433.
  4. Switch to the Deploy tab. Clear all options, then select only the following Server Actions:

    • Build EAR/WAR files
    • Create profile
    • Configure server
    • Deploy application

    Confirm that all Combined Actions or Database Actions are clear.

    Click Execute.

  5. In the Deploy tab of the deployment utility, clear all options and then select Start server.

    Click Execute.

Enable Encryption for Data Transfer between 3DOrchestrate and MSSQL Server

You can enable encrypted communications for data transfer between 3DOrchestrate and an MSSQL server. The MSSQL host must be a fully qualified domain name (FQDN) of the MSSQL server.

  1. Start the deployment utility GUI from the command line by executing the following batch file:

    <server_install_dir>\win_b64\reffiles\SMAExeServer\deploy\smaexe-deploy.bat

  2. In the MSSQL Preconfigured tab, select Encrypt connection.