dbm (Database manger) service configuration
The dbm service (database manager service) allow access to one or more relational databases. It will create and use DataSource objects.
Caution The recommended way to access to databases is to use the resource service deploying JDBC resource adapter.
The dbm service provides a generic driver-wrapper that emulates the XADataSource interface on a regular JDBC driver.It is important to note that this driver-wrapper does not ensure a real two-phase commit for distributed database transactions.
When it is necessary to use a JDBC2-XA-compliant driver access to the databases must be done via a JDBC resource adapter XA compliant.
Here is the part of jonas.properties related to dbm service :
################ JOnAS DBM Database service configuration
# Set the name of the implementation class of the dbm service
jonas.service.dbm.class org.ow2.jonas.dbm.internal.JOnASDataBaseManagerService
# Set the jonas DataSources. This enables the JOnAS server to load the data dources, to load related jdbc drivers, and to register the datasources into JNDI.
# This property is set with a coma-separated list of Datasource properties file names (without the '.properties' suffix)
# Ex : Oracle1,InstantDB1 (while the Datasources properties file names are Oracle1.properties and InstantDB1.properties)
jonas.service.dbm.datasources HSQL1
For the dbm service it is possible to :
- Set a list of datasource names via property jonas.service.dbm.datasources for each name XX appearing in this list a XX.properties file must exist in $JONAS_BASE/conf
Access to a particular database via dbm service is configured in datasource.properties files that must be located in $JONAS_BASE/conf
Datasource.properties files
In the JOnAS distribution several templates of datasource.properties files are provided one for Oracle, PostgreSQL, Sybase, DB2, MySQL, HSQLDB, InterBase, FirebirdSQL, Mckoi SQL, InstantDB respectively in Oracle1.properties, PostgreSQL1.properties etc.
DataSource example
Here is the template for an Oracle dataSource.properties file that can be found in $JONAS_ROOT/conf :
####### Oracle DataSource configuration example
### DataSource configuration
datasource.name jdbc_1
datasource.url jdbc:oracle:thin:@<your-hostname>:1521:<your-db>
datasource.classname oracle.jdbc.driver.OracleDriver
datasource.username <your-username>
datasource.password <your-password>
datasource.mapper rdb.oracle
####### ConnectionManager configuration
### JDBC connection checking level.
# 0 = no special checking | 1 = check physical connection is still open before reusing it | 2 = try every connection before reusing it
jdbc.connchecklevel 0
# Max age for jdbc connections - nb of minutes a connection can be kept in the pool
jdbc.connmaxage 1440
# Maximum time (in mn) a connection can be left busy.
# If the caller has not issued a close() during this time, the connection will be closed automatically.
jdbc.maxopentime 60
# Test statement
jdbc.connteststmt select * from dual
# JDBC Connection Pool size - Limiting the max pool size avoids errors from database.
jdbc.minconpool 10
jdbc.maxconpool 30
# Sampling period for JDBC monitoring : nb of seconds between 2 measures.
jdbc.samplingperiod 30
# Maximum time (in seconds) to wait for a connection in case of shortage. This may occur only when maxconpool is reached.
jdbc.maxwaittime 5
# Maximum of concurrent waiters for a JDBC Connection. This may occur only when maxconpool is reached.
jdbc.maxwaiters 100
No comments:
Post a Comment
Note: only a member of this blog may post a comment.