Sahi Pro - Storing Reports in MSSQL Database

By default Sahi stores its reports in a H2 database which is bundled in Sahi.
Sahi reports can now also be logged in MSSQL database.
To store in a MSSQL database, do the following:

Create a Database

Create a database in MSSQL using any MSSQL client. Let us assume that the name of the database is sahireports

Create Tables

There is a create tables script available at
sahi/userdata/config/db/create_report_tables_mssql.sql
Run this script on sahireports database to create the necessary tables.

Add MSSQL Driver Jars to Sahi Classpath

Download the MSSQL Connector,
extract and copy sqljdbc4.jar to sahi/userdata/extlib/db folder (create if needed).
Then add the jar to Sahi's classpath

Point Sahi to use the MSSQL Database

Add the following to userdata.properties
# Specifies database type.
# The inbuilt options are "mysql", "h2" and "mssql"
# Change jdbc parameters accordingly
db.type=mssql

#JDBC parameters for mssql database
db.driver_name=com.microsoft.sqlserver.jdbc.SQLServerDriver
db.jdbc_url=jdbc:sqlserver://localhost:1433;databaseName=sahireports
db.user_name=sa
db.password=abcd123

Change the user_name, password and database name as required.

Restart and Run

Restart Sahi, run a script and check!