Creating H2 database for Web Viewer 14.0
search cancel

Creating H2 database for Web Viewer 14.0

book

Article ID: 117681

calendar_today

Updated On: 11-09-2022

Products

View Output Management Web Viewer

Issue/Introduction

Attempting to get the new R14 web viewer working. How do I run the DDL created as part of the install process? I have Tomcat up and running and also H2 Console.
When I tried to create an internal h2 database...the manual says...it is created at deployment. We don't as such do deployment. But when I started the Tomcat server....no evidence of any database related activity. 

Environment

Release: Web Viewer (Content Viewer) 14.0
Component: WBVMTC

Resolution

In H2 the database is a file within USS and the database name is just the path and name of the file (H2 may add an extension to the file).
 
When you log into the H2 console you provide H2 with a JDBC URL, a user name and a password for the database.  The JDBC URL should be in one of the following formats:
 
For an internal database:              jdbc:h2:file:<fully-qualified-uss-path>/<database-name>
For an external database:             jdbc:h2:tcp://<host>:<port>/<fully-qualified-uss-path>/<database-name>
 
Where:
<host>:<port> is the host and port name of the H2 server
<fully-qualified-uss-path> is the fully qualified USS directory for the database
<database-name> is the file name for the database
 
For example, using a <database-name> of wvdatabase and a <fully-qualified-uss-path> of /u/users/webview/db you would logon to the H2 console using a JDBC URL of:
 
For an internal database:              jdbc:h2:file:/u/users/webview/db/wvdatabase
For an external database:             jdbc:h2:tcp://<host>:<port>//u/users/webview/db/wvdatabase
 
And after you created the database and ran the scripts you should see a file that starts with wvdatabase in directory /u/users/webview/db.  Note that on our system H2 adds the extension mv.db so the filename shows up as wvdatabase.mv.db.
 
The location is specified to Web Viewer in the ConfigFile.cfg using the format:
 
For an internal database:              DBLOCATION = "<fully-qualified-uss-path>/<database-name>";
For an external database:             DBLOCATION = "tcp://<host>:<port>/<fully-qualified-uss-path>/<database-name>";
 
So for the same example:
 
For an internal database:              DBLOCATION = "/u/users/webview/db/wvdatabase";
For an external database:             DBLOCATION = "tcp://<host>:<port>//u/users/webview/db/wvdatabase";
 
DBUSER and DBPASSWORD should be the same user name and password that were provided to the H2 console.
 
There should be messages in the STDOUT file of the Tomcat server from the Web Viewer start-up that indicate it is connecting to the database. 




 

Additional Information

For additional information, please consult our online documentation for Create the H2 Database Server.