Monday, 28 March 2016

How to configure "db" service in JOnAS ?


db service configuration

The db service is an optional service that can be used to start a java database server in the same JVM as JOnAS.
By default the database used is HSQLDB.

Here is the part of jonas.properties related to db service : 
###################### JOnAS DB service configuration
# Sets the name of 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

Here it is possible to customize : 
  • Listening port
  • Database name
  • 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 follows
    :
jonas.service.db.users    login:password,anotherlogin:password

The database may be used by Java EE component via JDBC resource adapters or via the dbm service.

For the former case the same information (listening port, database name, login, password) must appear in the JOnAS connector deployment descriptor, in the latter they appear in the $JONAS_BASE/conf/HSQLDB1.properties.
So, if these previous properties must be changed in jonas.properties, they must be also changed in these files.

The db service has been provided in the jonas distribution mainly to run easily the JOnAS exemple, without having to set a database first.
For most usages, the JOnAS users should remove it from the list of services and remove also HSQL1 from jonas.service.dbm.datasources property in $JONAS_BASE/conf/jonas.properties file.

In order to launch several HSQLDB instances, the configuration needs to be duplicated and the new configuration will be prefixed by jonas.service.<mynewdbservice>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.