H2 database
-
How do I go about running the h2-console on a laptop and connect to the database on a server?
Mango and the db are on the server. Do I need to install the h2-console on both? -
Hi Larry,
The easiest way is to launch the h2-web-console script in Mango/bin/ from the device that has the database, and add -webAllowOthers if you will be accessing it from a different machine (which you will be, it sounds).
I don't believe there is a means to connect a web console started on your machine to the remote database.
Here's a help document relevant to H2 and using the web console: http://help.infiniteautomation.com/support/solutions/articles/14000022661-about-the-h2-database
-
I am having a problem with the h2 db. Mango is running on a server and when I run the h2-console on the server it show that it connects to the db, but the db is an empty one just like the test db. When I saw this I logged on to mango and started the SQL console and ran the get tables and it show the current database tables? I ran the (select * from DATAPOINTS) query and all the data points are there.
But when I try to connect from the h2 console with (jdbc:h2:tcp://192.168.1.10/IT Dept Installs/Mango Automation 2.7.10 Enterprise Demo/databases/mah2.h2.db) Path and file It show a new test type table structure. Not sure how to connect to the real db???????? -
You need to get the connection string right; it has a somewhat pesky behavior of creating an empty database in the location specified by the connection string, which is probably what you're experiencing. Running h2-web-console the server with the database, you'll navigating in your browser to http://[ip]:[port defined in h2-web-console script]/ .
Your connection string should be jdbc:h2:/path/to/Mango/databases/mah2
-
. Phil The trouble it turns out was the h2-*.jar file being on my computer not on the server. After I moved it the console connected with no errors and I can see all the data points from my computer. Again thanks for all your help.