Q1. How to configure eXo Platform to connect to other database systems?
Configuring eXo Platform to connect to other database can be done easily by reusing sample configurations provided in the package.
For Tomcat, sample configuration files are:
$PLATFORM_TOMCAT_HOME/conf/server-mssql.xml
$PLATFORM_TOMCAT_HOME/conf/server-hsqldb.xml
$PLATFORM_TOMCAT_HOME/conf/server-mysql.xml
$PLATFORM_TOMCAT_HOME/conf/server-postgres.xml
$PLATFORM_TOMCAT_HOME/conf/server-postgresplus.xml
$PLATFORM_TOMCAT_HOME/conf/server-oracle.xml
$PLATFORM_TOMCAT_HOME/conf/server-sybase.xml
$PLATFORM_TOMCAT_HOME/conf/server-db2.xml
For JBoss, configurations are pre-defined in the $PLATFORM_JBOSS_HOME/standalone/configuration/standalone-exo.xml
file. You just need to uncomment them for use.
Q2. How to remove the idle MySQL connections?
Some RDBMSs, like MySQL, close the idle connections after a period (8 hours on MySQL by default). Thus, a connection from the pool will be invalid and any application SQL command will fail, resulting in errors as below:
org.hibernate.SessionException: Session is closed! at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:72) at org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1342)
To avoid this, you can use DBCP to monitor the idle connections and drop them when they are invalid, with the testWhileIdle, timeBetweenEvictionRunsMillis, and validationQuery parameters.
The validation query is specific to your RDBMS. For example, on MySQL, you would use:
testWhileIdle="true" timeBetweenEvictionRunsMillis="300000" validationQuery="SELECT 1"
In which:
testWhileIdle activates the idle connections monitoring.
timeBetweenEvictionRunsMillis defines the time interval between two checks in milliseconds (5 minutes in the example).
validationQuery provides a simple SQL command to validate connection to the RDBMS.
For more details on the configuration, or some examples on other RDBMS and applications servers, refer to the following websites:
Q3. How to enable managed DataSource?
In JBoss, when you want to use a managed data source, set "true" for the gatein.jcr.datasource.managed
property in the $PLATFORM_JBOSS_HOME/standalone/configuration/gatein/configuration.properties
file.
gatein.jcr.datasource.managed=true