Helma Logo
main list history
previous version  overview  next version

Version 1 by hannes on 17. February 2009, 22:53

This is a short howto for how to configure Helma with <a href="http://www.mysql.com/">MySQL</a>.

<a href="http://www.mysql.com/">MySQL</a> is a popular Open Source Relational Database that is available for all major operating systems and comes preconfigured on many Linux distributions. This HOWTO assumes you have a MySQL server up and running. For information on configuring MySQL please refer to the appropriate documentation.

Helma can use any <a href="http://java.sun.com/products/jdbc/">JDBC</a> compliant <a href="http://servlet.java.sun.com/products/jdbc/drivers">driver</a> as datasource, so this document may apply to other database drivers, especially if they are pure Java drivers and do not require native code to be loaded.

Setting up MySQL as Helma datasource is a simple process:

<ol>
<li>Get a recent <a href="http://www.mysql.com/downloads/api-jdbc-stable.html">MySQL Connector/J</a> JDBC driver from the MySQL site. Previous versions of Helma came with the MySQL driver pre-installed, but we stopped doing so because it was to hard to keep up with new versions, and the driver is not a core component of Helma.</li>
<li>Unpack the Connector/J archive and install the driver by copying the mysql-connector-*.jar file to the lib/ext directory of your Helma installation. Jar files in lib/ext will be automatically added to the Helma classpath, no manual fiddling with the classpath is required.</li>
<li>Add a file called db.properties to the directory of the application in which you wish to use the MySQL datasource
<pre>
# Properties of mysql datasource
mysql.url = jdbc:mysql://localhost/dbname
mysql.driver = com.mysql.jdbc.Driver
mysql.user = joe
mysql.password = secret
</pre>
Make sure to replace the <tt>dbname</tt> with the name of the MySQL database you want to use, and specify a valid username/password combination. The JDBC URL may also vary if you want to connect to a MySQL server running on another server or another port than the default port, e.g. <tt>jdbc:mysql://foo.bar.com:3456/dbname</tt>.

In this example, the name of the data source is <tt>mysql</tt>, but of course you can use any other name instead.
</li>
</ol>

This should be it. After restarting Helma, you should be able to access the MySQL data source using either the *helma.Database module|http://helma.zumbrunn.com/reference/helma.Database.html* or through Helma's *Object-Relational Mapping* layer.

If you have a problem accessing the MySQL data source make sure the username and password you are using are allowed to connect from the server you're running Helma on. MySQL uses separate authentication settings for connects from the local host an remote hosts, so this is a frequent stumbling block.

For a convenient way to issue SQL statements against a Helma data source have a look at *SqlShell|http://helma.zumbrunn.com/tools/about_sqlshell*.

     removed
     added