Helma logo
helma.org » Home > docs > tutorial > Database Connection

Database Connection

While Helma features an embedded object-oriented database, where HopObjects are persisted when they are not mapped to an external database, Helma is able to connect to almost any database system in the world. Well, at least if there is a so-called JDBC driver available for it. See the short guide about using MySQL, which should help you preparing the freely available MySQL server for a connection with Helma.

To wire the MySQL database to your Helma application, you need a file called db.properties in your application root (ie. the folder addressbook according to my example). Use your favorite text editor and enter the following lines:

apps/addressbook/db.properties:

myDataSource.url      = jdbc:mysql://localhost/addressbook
myDataSource.driver   = org.gjt.mm.mysql.Driver
myDataSource.user     = helma
myDataSource.password = password
This defines myDataSource as a connector to the MySQL database called addressbook for the user helma identified by the password password – which you should replace with your password as chosen when setting up the MySQL installation (you certainly can use a different user/password combination as well, as long as it allows to connect to the MySQL server).

If you want to use a different database system or if you gave a different name to your database, that's no problem for Helma at all. Simply replace your JDBC driver or fill in the appropriate name. And certainly, you also can connect to a database server on another machine by arranging the URL, though you might have to set the database access privileges differently.

If you have done everything alright, you should restart either Helma or at least the addressbook application.

To restart an application visit the manage-interface at http://localhost:8080/manage/. If you haven't visited it up to now you'll get asked to set an initial password. Unless you are experimenting with a local Helma installation, you will probably have to edit the server.properties file and add your (local) IP address to the allowAdmin property.


Up: Tutorial
Previous: Preparing Helma Next: Object-Relational Mapping

... comment


Page last modified on 2006-01-01 17:36 by czv