Skip to content

Latest commit

 

History

History
 
 

database

FINOS | TraderX Sample Trading App | Database

DEV Only Warning Local Dev Machine Supported

Introduction

This is designed to play the role of a SQL database that runs standalone as part of an example environment. The other processes in this environment interact with this via SQL / JDBC drivers and therefore this component can be swapped out in other iterations of this environment and replaced with a robust and productionizable RDBMS.

This uses H2 Java-based database as a standalone server, has NO authentication by default, and initializes with an empty SQL schema every time it is started.

Default Port Numbers

Protocol Port Number
TCP 18082
PG 18083
HTTP 18084

Connecting to this database remotely

You can use the $DATABASE_TCP_PORT or $DATABASE_PG_PORT and the database URL in JDBC is jdbc:h2:./_data/traderx

The default username and password are both sa

Connecting to the web console

You can use the $DATABASE_HTTP_PORT or $DATABASE_PG_PORT and the database URL in JDBC is jdbc:h2:traderx (This is because -baseDir is already set to ./_data) - NOTE you will have to change the default setting in the web console which often uses a home directory path.

The default username and password are both sa

The database you want to use in the H2 GUI is ./traderx (This may not be the default listed in the GUI)

Output Directory

Data is stored in the local ./_data directory from where the script is run. This is .gitignore'd

Building

This builds in gradle to retrieve H2.

$> gradle build

Running on Linux

This is desinged to run on Linux but can easily run on Windows as well. It launches a DB Script runner to pre-populate the database schema- delayed by 20 seconds, and then runs the database server in the foreground.

Currently the run script has environment variables defined for versions of H2 and common ports. These should be altered (or made configurable outside the script) as the environment matures.

To launch, all that should be needed is running:

$> run.sh

Running from your local Win10 Machine

You CAN run this on windows, with the help of Powershell. All you need to do is have Java on your path, and then enter bash to run the script. First launch a Terminal/Command Console in Windows.

>bash
>$ . run.sh

You will see the following output


Runing startup script
Web Console server running at http://[your IP]:18084 (others can connect)
finished startup script
TCP server running at tcp://[your IP]:18082 (others can connect)
PG server running at pg://[your IP]:18083 (others can connect)

On my windows PC, it actually doesn't work with the public IP address. Just change the above URLs/Host Addresses to use localhost and they work fine.

Example: http://localhost:18084