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.
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:
Visit the official page of H2Database and download the last stable version for your platform
Navigate to the H2 Console, for e.g. if installed on Windows OS : Window's Start > H2 Console
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\data and press Connect without any username and password.
Once connected you will be able to view the schema and all the data stored within, like so
Hi Rajanikant, can you please elaborate more your use case what sort of database are you referring to i.e. an external data store or Persistence Provider for ThingWorx? Or are you looking to create just a DataTable ?
Would recommend you to please open a separate thread/discussion to ask your specific question in detail so it gets more visibility on the Developer Community.
Thanks for sharing the information.
i have also connected thingworx with h2 db and i am able to view the schema . But how can we view the tables which are stored in thingworx db ? like thing, thing templates , user groups etc?