<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xml:lang="en" xml:id="services.db.config"><info><title>db service configuration</title></info>
  

  <para>The <emphasis role="bold">db</emphasis> service is an optional service
  that can be used to start a java database server in the same JVM as
  <xi:include href="../../variables.xml" xpointer="appserver"/>.</para>

  <para>By default the database used is <link xlink:href="http://hsqldb.org/">HSQLDB.</link></para>

  <para>Here is the part of <filename>jonas.properties</filename> related to
  <emphasis role="bold">db</emphasis> service:</para>

  <screen>###################### JOnAS DB service configuration
#
#  Sets the name of the implementation class of the db service (hsql for example)
jonas.service.db.class   org.ow2.jonas.db.hsqldb.HsqlDBServiceImpl
jonas.service.db.port    9001
jonas.service.db.dbname  db_jonas
jonas.service.db.users   jonas:jonas

# Multiple users
#jonas.service.db.users  jonas:jonas,login:password
</screen>

  <para>Here it is possible to customize :</para>

  <itemizedlist>
    <listitem>
      <para>the listening port</para>
    </listitem>

    <listitem>
      <para>the database name</para>
    </listitem>

    <listitem>
      <para>By default, the user is named jonas with the password jonas. In
      order to add new users, the property jonas.service.db.users needs to be
      updated by using a comma separated list as follow:</para>

      <screen>jonas.service.db.users   login:password,anotherlogin:password</screen>
    </listitem>
  </itemizedlist>

  <para>The database may be used by <xi:include href="../../variables.xml" xpointer="j2ee"/> component via
  JDBC resource adapters or via the <emphasis role="bold">dbm
  </emphasis>service. For the former case the same information (listening
  port, database name, login,password) must appear in the <xi:include href="../../variables.xml" xpointer="appserver"/> connector deployment descriptor, in the latter they
  appear in the <filename class="directory">$JONAS_BASE/conf/HSQLDB1.properties.</filename> So, if
  these previous properties must be changed in jonas.properties, they must be
  also changed in these files.</para>

  <para>The <emphasis role="bold">db</emphasis> service has been provided in
  the jonas distribution mainly to run easily the <xi:include href="../../variables.xml" xpointer="element(appserver)"/> exemple, without having to set a database
  first. For most usages, the <xi:include href="../../variables.xml" xpointer="element(appserver)"/>
  users should remove it from the list of services and remove also HSQL1 from
  <property>jonas.service.dbm.datasources</property> property in
  <filename>$JONAS_BASE/conf/jonas.properties</filename> file.</para>

  <para>For users that choose HSQLDB as database it is highly recommended to
  refer to the <link xlink:href="http://hsqldb.org/web/hsqlDocsFrame.html">Hsqldb
  User Guide</link>. It is worth to note that the default configuration file
  used by HSQLDB server can be found in <filename class="directory">$JONAS_BASE/work/hsqldb/jonas/db_jonas.properties</filename>
  directory.</para>

  <para>In order to launch several HSQLDB instances, the configuration needs
  to be duplicated and the new configuration will be prefixed by
  jonas.service.&lt;mynewdbservice&gt;.</para>
</section>