# database mapping

Helma allows you to map your HopObjects to relational database tables instead of persisting them in the application's embedded XML database.

The list of available database connections is defined inside the file ./db.properties in Helma's home directory or for application specific configurations in a db.properties file inside an application's code repository.

    myDataSource.url = jdbc:mysql://db.domain.com/space
    myDataSource.driver = org.gjt.mm.mysql.Driver
    myDataSource.user = username
    myDataSource.password = xyz

In order to add the specified JDBC driver to the classpath, place it in the ./lib/ext/ directory. Depending on the database system you are using, you may want to download an appropriate JDBC driver, for example a driver for MySQL.

Using the SQLshell from within your application, you may at any time explore your database and issue SQL statements. The SQLshell also allows you to map your database tables to properties of your application's prototypes as desired. A simple configuration for your object/relational mappings might look as follows:

    _db         = myDataSource
    _table      = PERSON
    _id         = ID

    firstname   = FIRSTNAME
    lastname    = LASTNAME
    email       = EMAIL
    createtime  = CREATETIME
    modifytime  = MODIFYTIME

These configurations would be placed in a type.properties file inside the corresponding prototype directory, for example in ./apps/addressbook/Person/type.properties, when following the "addressbook" tutorial.

To learn how Helma's relational database mapping is put to work and how it relates and integrates with the other central aspects of the framework, follow the tutorial and build the full "addressbook" application.

More information about the object/relational mapping of HopObject properties:
/docs/Properties+Files/db.properties/
/docs/Object-Relational+Mapping/