Helma and MySQL
This is a short howto for how to configure Helma with MySQL.
MySQL 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.
Setting up MySQL as Helma datasource is a simple process:
- Get a recent MySQL Connector/J 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.
- 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.
Add a file called db.properties to the directory of the application in which you wish to use the MySQL datasource
In this example, the name of the data source is mysql, but of course you can use any other name by using a different property name prefix. Make sure you 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. jdbc:mysql://foo.bar.com:3456/dbname.
# Properties of mysql datasource mysql.url = jdbc:mysql://localhost/dbname mysql.driver = com.mysql.jdbc.Driver mysql.user = joe mysql.password = secret
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.