View source | Discuss this page | Page history | Printable version   

ERP 2.50:Developers Guide/How to develop dbsourcemanager

ERP 2.50:Developers Guide




DBSourceManager is a tool used by Openbravo to build, update and export the database. Users typically don't see most of the functionality it provides, but developers rely on it for a big part of their activity, through the usage of the create.database, update.database, export.database and export.config.script tasks.

Although the dbsourcemanager related tasks are heavily used, common development activity in Openbravo does not involve developing the dbsourcemanager tool itself. However, there might be situations in which one dbsourcemanager task is failing, and additional debug log is needed to find out why. Also, somebody might be interested in further developing some of the capabilities that dbsourcemanager provides.

This article is relevant for both kind of situations.

Downloading the source

There is a specific Mercurial repository for dbsourcemanager. To get the code, you can execute the following command:

    hg clone

This will create a folder called dbsm-main, with will contain the dbsourcemanager code.

Configuring and compiling dbsourcemanager

To compile dbsourcemanager, you first need to configure a properties file. Copy the into a file and modify it:


There is only one property to configure: the path of your current Openbravo workspace.

Once you've configured it, you can compile dbsourcemanager:

   ant jar

This will compile the sources and generate a dbsourcemanager.jar file. To use this .jar file, copy it into the src-db/database/lib folder, inside your Openbravo folder.

Debugging with dbsourcemanager

Dbsourcemanager is a .jar file used by Openbravo ant tasks. As it is a .jar file invoked by ant tasks, there is currently no nice way to debug it using Eclipse. The most common way to do debugging tasks is to add log4j debug statements in the code itself.

Most dbsourcemanager classes have a log instance. You can usually use this log instance to generate debug statements such as:

    log.debug("This code was executed");

By default, this message will not be shown unless you are running in log4j DEBUG error level. You can configure the log4j error level in your file, inside the config folder of your Openbravo folder. There is a property called "bbdd.verbosity", which is set as error level "INFO" by default. You can change it to "DEBUG" if you want to see the debug messages, or you can also directly issue INFO messages:"This code was executed");

Retrieved from ""

This page has been accessed 7,320 times. This page was last modified on 14 June 2011, at 11:04. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.