H2 database provided as an embedded persistence provider with ThingWorx. However, for those of us interested in peeking inside the structure of how the data is persisted, it's challenging to simply connect to it like other databases which are installed separately e.g. PostgreSQL, SAP Hana, or any other RDBMS connecting to ThingWorx via JDBC.


Disclaimer: This guide is for the purpose of debugging or view only scenarios. Any direct change to the stored data in the H2 database may lead to data corruption leading to data loss or ThingWorx failing to start.


How to connect to embedded H2 Database installation


Challenging as it may appear at first sight, connecting to H2 Database embedded with ThingWorx is quite straight forward. Here's a quick guide to it:


1. Download and Install H2 Database engine


     Visit the official page of H2Database and download the last stable version for your platform


2. Access the H2 Database browser


     Navigate to the H2 Console, for e.g. if installed on Windows OS : Window's Start > H2 Console

3. Connecting to the H2 Database embedded with ThingWorx

     H2 Console is a web based UI and will be launched in a web browser, see following sample screenshot. For connecting to the existing embedded H2 DB used within           ThingWorx, simply provide the location for the \\ThingWorxStorage\Database\ and press Connect without any username and password.

4. Exploring the H2 Console

     Once connected you will be able to view the schema and all the data stored within, like so