DayTrader 7 ships with a pre-populated Apache Derby database atDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/WASdev/sample.daytrader7/llms.txt
Use this file to discover all available pages before exploring further.
daytrader-ee7/resources/data/tradedb so you can start the application immediately without any external database infrastructure. For performance benchmarking and load testing, IBM DB2 is the recommended backend — it supports the connection pooling, bufferpool tuning, and backup/restore workflow that rigorous benchmark methodology requires.
Using embedded Derby
The Derby database is packaged directly in the repository and is referenced inserver.xml as:
${shared.resource.dir} to <LIBERTY_HOME>/usr/shared/resources/. The Maven build copies the pre-populated Derby store into that location automatically when you run mvn clean install.
Default credentials (set in server.xml authData elements):
| Element | User | Password |
|---|---|---|
TradeDataSourceAuthData | db_username | db_password |
TradeAdminAuthData | db_username | db_password |
The embedded Derby database already contains 15,000 users (
uid:0 through uid:14999) and 10,000 stock quote symbols (s:0 through s:9999). You do not need to run the populate step for local development.Reinitializing the Derby database
If you need to reset or rebuild the tables and sample data (for example, after schema changes), use the built-in configuration UI:Open the configuration page
Navigate to
http://localhost:9082/daytrader/configure.html in a browser.Recreate tables
Click “(Re)-create DayTrader Database Tables and Indexes”. This runs the DDL script appropriate for the detected database product.
TradeConfigServlet automatically chooses the correct script from the dbscripts/ directory based on the database product name returned by the JDBC driver:
| Database product | DDL script path |
|---|---|
DB2/ | dbscripts/db2/Table.ddl |
DB2 UDB for AS/400 | dbscripts/db2i/Table.ddl |
Apache Derby | dbscripts/derby/Table.ddl |
Oracle | dbscripts/oracle/Table.ddl |
daytrader-ee7-web/src/main/webapp/dbscripts/.
Using DB2
IBM DB2 is the recommended database for load testing and benchmarking. Switch to DB2 by replacingserver.xml with the provided server_db2.xml configuration.
Create the database
Disable DB2_APM_PERFORMANCE
This registry variable must be off before database creation, otherwise DB2 raises
SQL1803N: The requested operation cannot be executed in "No Package Lock".Configure Liberty to use DB2
Set the following environment variables on the Liberty server machine to match your DB2 environment. These are referenced directly inserver_db2.xml via ${variable} substitution:
server.xml with the DB2 variant:
Load the database
Start Liberty and use the configuration page to create tables and populate data, exactly as described in the Derby section above:Database scale parameters
DayTrader 7’s database population size is governed by four constants inTradeConfig.java. The default values match what is pre-loaded in the embedded Derby store:
| Parameter | Default | Description |
|---|---|---|
MAX_USERS | 15,000 | Number of simulated trader accounts created in the ACCOUNTPROFILE and ACCOUNT tables |
MAX_QUOTES | 10,000 | Number of stock quote rows in the QUOTE table; symbols are s:0 through s:9999 |
KEYBLOCKSIZE | 1,000 | Block size used when generating batches of primary keys during database population |
QUOTES_PER_PAGE | 10 | Maximum number of quote symbols returned in a single /quote page request |
DB2 performance tuning
Before taking benchmark measurements, run the following tuning script on the DB2 server as the DB2 instance owner. These settings are taken directly from thebackupTradeDB.sh script provided in the repository:
Resetting between benchmark runs
Keeping the database in a known state between runs is essential for reproducible results. Two complementary reset mechanisms are available:- In-application reset (lightweight)
- DB2 restore (full)
The This is appropriate between warm-up runs or when only order-related state needs clearing.
resetTrade action truncates the ORDER table and resets account balances and holding quantities to their seeded values without a full DB2 restore. It is faster but only resets application-level state: