Helma Logo
main list history

Version 3 by hannes on 17. February 2009, 22:57

11
13
15<pre>
16# Properties of mysql datasource
17mysql.url = jdbc:mysql://localhost/dbname
18mysql.driver = com.mysql.jdbc.Driver
19mysql.user = joe
20mysql.password = secret
21</pre>
22Make 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>.
17In this example, the name # Properties of the data source is <tt>mysql</tt>, but of course you can use any other name instead.mysql datasource
18 mysql.url = jdbc:mysql://localhost/dbname
19 mysql.driver = com.mysql.jdbc.Driver
20 mysql.user = joe
21 mysql.password = secret
22
23In this example, the name of the data source is <tt>mysql</tt>, 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. <tt>jdbc:mysql://foo.bar.com:3456/dbname</tt>.

Version 2 by hannes on 17. February 2009, 22:54

10<li>Get a recent <a href="http://wwwhttp://dev.mysql.com/downloads/api-jdbc-stable.htmlcom/downloads/connector/j/">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>

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

1This is a short howto for how to configure Helma with <a href="http://www.mysql.com/">MySQL</a>.
3<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.
4
5Helma 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.
6
7Setting up MySQL as Helma datasource is a simple process:
8
9<ol>
10<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>
11<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>
12<li>Add a file called db.properties to the directory of the application in which you wish to use the MySQL datasource
13<pre>
14# Properties of mysql datasource
15mysql.url = jdbc:mysql://localhost/dbname
16mysql.driver = com.mysql.jdbc.Driver
17mysql.user = joe
18mysql.password = secret
19</pre>
20Make 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>.
21
22In this example, the name of the data source is <tt>mysql</tt>, but of course you can use any other name instead.
23</li>
24</ol>
25
26This 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.
27
28If 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.
29
30For a convenient way to issue SQL statements against a Helma data source have a look at *SqlShell|http://helma.zumbrunn.com/tools/about_sqlshell*.