This section addresses the setup and installation of a Microsoft SQL Server (MSSQL) audit trail database. It includes setup of MSSQL, creation of the MSSQL audit trail database and schema.
The following sections assume basic understanding of MSSQL database server installation and configuration.
Before an audit trail database can be created, a properly installed and configured instance of a MSSQL database server must exist. MSSQL can be downloaded from the following MSSQL Download Website.
After downloading MSSQL, install MSSQL on the database server. During Installation of MSSQL Server, select the Authentication Mode as Mixed Mode which includes both Windows Authentication and SQL Server Authentication. Provide a password for SQL Server Authentication, whose default user name is 'sa'.
Once the database is started, invoke the MSSQL client to continue the creation of the Stardust audit trail database. Go to Windows Command Prompt.
C:\>sqlcmd -Usa -P
Enter the password at the prompt.
If login is successful, the following is displayed:
1>
At the 1> prompt, execute the following commands to create the database with name dbName:
1> create database <dbName>; 2> go
Create a new login with dbcreation privilege, then create a user for this login and grant db_owner role to it.
1> CREATE LOGIN <login> WITH PASSWORD = '<password>', DEFAULT_DATABASE = <dbName>, CHECK_EXPIRATION = OFF, CHECK_POLICY = OFF; 2> go 1> sp_addsrvrolemember '<login>', 'dbcreator'; 2> go 1> use <dbName>; 2> go Change database context to '<dbName>'. 1> CREATE USER <username> FOR LOGIN <login>; 2> go 1> sp_addrole 'db_owner', '<username>'; 2> go
Create Schema for the above created database.
1> use <dbName> 2> go Changed database context to '<dbName>'. 1> create schema <schemaName> AUTHORIZATION <username> 2> go
Once the database has been created, the audit trail database schema must be created within MSSQL. This process utilizes the System Console utility provided with Stardust. Execute the System Console with the following arguments:
sysconsole -v -r <jdbcDriver> -dbtype MSSQL8 -dbschema <dbschema> -l jdbc:jtds:sqlserver://<host>:<port>/<dbName> -d <user> -s <password> createschema
The following is displayed after the command is invoked:
Stardust (TM) Administration Console, Version 4.x Copyright (C) SunGard CSA LLC, 2000-2011. All rights reserved. Create Stardust schema: Database type : MSSQL8 Database URL : jdbc:jtds:sqlserver://<host>:<port>/<dbName> Database user : <user> Database driver : <jdbcDriver> Do you want to proceed? (Y/N):
Answer Y to proceed. The following is displayed after successful creation of the audit trail database schema.
Schema created.
If you do not have the ability to directly create the database schema because of privileges within your database environment or desire to create a file with the appropriate SQL commands, the following procedures can be followed to create a file containing the appropriate DDL and DML statements that can be executed within the database as a SQL script.
sysconsole -v -dbtype MSSQL8 ddl -file <fileName> -schemaName <schemaName>
Once the DDL/DML file has been created by the previous command, follow the Database setup instructions from the previous sections if not already completed, and then have a user with appropriate privileges execute the created DDL/DML script file as such:
mssql> source <fileName>
Execute the following SQL to modify the MSSQL database locking behavior:
ALTER Database carnot SET READ_COMMITTED_SNAPSHOT ON WITH ROLLBACK IMMEDIATE /* SELECT is_read_committed_snapshot_on #FROM sys.databases #WHERE name = N'carnot' #Return value should be 1 */
To enable the XA transaction support, follow the instructions described in the Understanding XA Transactions article.
The following sections discuss the data source / database connection pool setup of the audit trail database based on the deployment mode.
If you use Stardust in Spring local mode, you have to perform the following steps:
AuditTrail.Type = MSSQLSet the type of the audit trail database to MSSQL8 and use the database driver class net.sourceforge.jtds.jdbc.Driver.
AuditTrail.DriverClass = net.sourceforge.jtds.jdbc.Driver
AuditTrail.URL = jdbc:jtds:sqlserver//<host>/<port>/<dbName>
AuditTrail.User = <yourDBUserName>
AuditTrail.Password = <yourDBUserPassword>
<bean id="carnotXaAuditTrailDataSource" class="net.sourceforge.jtds.jdbcx.JtdsDataSource" lazy-init="true">
<property name="serverName" value="${AuditTrail.ServerName}" />
<property name="portNumber" value="${AuditTrail.Port}" />
</bean>The audit trail database data source and connection pool setup is configured based on the application server/container utilized for the Stardust deployment. Refer to Application Server Setup for more information regarding data source and connection pool setup for an audit trail database.
As MSSQL always performs a case insensitive String comparison, the usage of the Boolean parameter caseSensitive in a DataFilter query will have no effect when using MSSQL.