Set the type of workload to run. A timed workload with suppressed output is strongly recommended as a test workload will print considerable output to the command prompt.
hammerdb>diset tpcc mssqls_driver timed Clearing Script, reload script to activate new setting Script cleared Changed tpcc:mssqls_driver from test to timed for MSSQLServer
Configure workload settings, in this example the rampup and duration times are set.
hammerdb>diset tpcc mssqls_rampup 1 Changed tpcc:mssqls_rampup from 2 to 1 for MSSQLServer hammerdb>diset tpcc mssqls_duration 3 Changed tpcc:mssqls_duration from 5 to 3 for MSSQLServer
Confirm the settings with the print dict command.
hammerdb>print dict
Dictionary Settings for MSSQLServer
connection {
mssqls_server = (local)
mssqls_linux_server = localhost
mssqls_tcp = false
mssqls_port = 1433
mssqls_azure = false
mssqls_authentication = windows
mssqls_msi_object_id = null
mssqls_linux_authent = sql
mssqls_odbc_driver = ODBC Driver 18 for SQL Server
mssqls_linux_odbc = ODBC Driver 18 for SQL Server
mssqls_uid = sa
mssqls_pass = admin
mssqls_encrypt_connection = true
mssqls_trust_server_cert = true
}
tpcc {
mssqls_count_ware = 10
mssqls_num_vu = 4
mssqls_dbase = tpcc
mssqls_imdb = false
mssqls_bucket = 1
mssqls_durability = SCHEMA_AND_DATA
mssqls_use_bcp = true
mssqls_total_iterations = 10000000
mssqls_raiseerror = false
mssqls_keyandthink = false
mssqls_checkpoint = false
mssqls_driver = timed
mssqls_rampup = 1
mssqls_duration = 3
mssqls_allwarehouse = false
mssqls_timeprofile = false
mssqls_async_scale = false
mssqls_async_client = 10
mssqls_async_verbose = false
mssqls_async_delay = 1000
mssqls_connect_pool = false
}When all the settings have been chosen load the driver script with the loadscript command. (If you don't do loadscript and do vurun, loadscript will be run automatically for you).
hammerdb>loadscript Script loaded, Type "print script" to view
The loaded script can be viewed with the print script command. Note that the driver script is exactly the same as the driver script observed in the GUI.
hammerdb>print script
#!/usr/local/bin/tclsh9.0
#OPTIONS
set library tdbc::odbc ;# SQL Server Library
set version 1.1.1 ;# SQL Server Library Version
set total_iterations 10000000;# Number of transactions before logging off
set RAISEERROR "false" ;# Exit script on SQL Server error (true or false)
set KEYANDTHINK "false" ;# Time for user thinking and keying (true or false)
set CHECKPOINT "false" ;# Perform SQL Server checkpoint when complete (true or false)
set rampup 1; # Rampup time in minutes before first Transaction Count is taken
set duration 3; # Duration in minutes before second Transaction Count is taken
set mode "Local" ;# HammerDB operational mode
set authentication "windows";# Authentication Mode (WINDOWS or SQL)
set server {(local)};# Microsoft SQL Server Database Server
set port "1433";# Microsoft SQL Server Port
set odbc_driver {ODBC Driver 18 for SQL Server};# ODBC Driver
set uid "sa";#User ID for SQL Server Authentication
set pwd "admin";#Password for SQL Server Authentication
set tcp "false";#Specify TCP Protocol
set azure "false";#Azure Type Connection
set database "tpcc";# Database containing the TPC Schema
set encrypt "true";# Encrypt Connection
set trust_cert "true";# Trust Server Certificate
set msi_object_id "null";# MSI Object ID for Entra authentication
#OPTIONS
#LOAD LIBRARIES AND MODULES
if [catch {package require $library $version} message] { error "Failed to load $library - $message" }
if [catch {package require tpcccommon} ] { error "Failed to load tpcc common functions" } else { namespace import tpcccommon::* }
...If you wish to view or modify the driver script you can also save a copy with the savescript command.
hammerdb>savescript mydriver.tcl Success ... wrote script to C:/temp/mydriver.tcl
and load the modified script with the customscript command. (As noted the saved script is the same in both the GUI and CLI and both can be saved and loaded interchangeably).
hammerdb>customscript C:/temp/mydriver.tcl Loaded C:/temp/mydriver.tcl