Posts /

H2 embedded DB and Alfresco 3.4

Twitter Facebook Google+
03 Aug 2011

One of the most useful thing an embedded DB can do for you is to provide a clean environment in your automated tests to use as a clean slate where to repeatedly and reliably test your code. It’s been a while since Alfresco broke compatibility with some embedded DB we used to run our tests (HSQLDB above all others).

I recently regained interest into cutting out any useless dependency on MySQL or PostgreSQL on the test server to run my Alfresco tests, and H2 looked sexy. I found here and there some promising work by other people, but none worked for me out of the box. I then started from scratch using PostgreSQL DB scripts and voila! Now I have back my Alfresco running against an embeddable DB! You can see & fork the results of my job if you like. It’s supposed to help you with a Maven Alfresco project, but you can probably benefit from it even if you’re using some other build tools.

As soon as you have all those files in your classpath, be sure you edit your alfresco-global.properties like the following: db.driver=org.h2.Driver db.url=jdbc:h2:alf_data/h2_data/alfresco db.username=alfresco db.password=alfresco hibernate.dialect=org.hibernate.dialect.H2Dialect Make sure you’re using an hibernate version >= 3.1 as per H2 documentation.


Twitter Facebook Google+