Skip to content

skommaSFDC/mule-in-memory-h2-db-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mule-in-memory-h2-db-connector

MuleSoft and in-memory DB H2 integration

Note: Database Config in the project shows ${app.home}/h2db/mule as the path for the file. Before pointing to this path, H2 db file mule.mv.db needs to be created locally first. Follow these steps.

  1. Create a folder on your local drive with the name h2db. Say for instance path to it is: C:/h2db
  2. Modify the URL in Database Config (H2_Db_Config in global.xml) to: jdbc:h2:file:C:/h2db/mule where mule is the actual DB filename (like instance name)
  3. Run the project, and execute /ddl endpoint. Upon successful run, it should create a file mule.mv.db within the folder C:/h2db
  4. In your proect workspace, under /src/main/resources, create a folder with the name h2db
  5. Copy the mule.mv.db file form C:/h2db to the folder /src/main/resources/h2db
  6. Then you are ready to modify the URL in Database Config (H2_Db_Config in global.xml) back to: ${app.home}/h2db/mule
  7. Run the Munit tests to make sure all tests pass

You can view the actual H2 DB in a web console by running this java command from the folder having the h2-1.4.200.jar :  java -cp h2-1.4.200.jar org.h2.tools.Server -web (jar file can be found in Project Libraries of the workspace). It will open H2 Console like shown below:

image

Once you click Connect, it will show the DB like shown below:

image