jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorge Rodríguez Pedrianes (JIRA) <j...@apache.org>
Subject [jira] Updated: (JCR-576) Close Connection when I use PersistenManager and FileSystem with mysql database
Date Fri, 22 Sep 2006 10:23:47 GMT
     [ http://issues.apache.org/jira/browse/JCR-576?page=all ]

Jorge Rodríguez Pedrianes updated JCR-576:

    Attachment: DatabaseFileSystem.java

The attachmented files are the modified classes that use the checkConnection method.

 An example of configuration is:

	<FileSystem class="org.apache.jackrabbit.core.fs.db.JNDIDatabaseFileSystem">
		<param name="dataSourceLocation" value="java:comp/env/jdbc/nameDS"/>
		<param name="checkValidConnectionSQL" value="select 0 from dual" />
		<param name="schemaObjectPrefix" value="repository_"/>

	<PersistenceManager class="org.apache.jackrabbit.core.state.db.JNDIDatabasePersistenceManager">
		<param name="dataSourceLocation" value="java:comp/env/jdbc/PriSolicitudDS"/>
		<param name="checkValidConnectionSQL" value="select 0 from dual" />				
		<param name="schemaObjectPrefix" value="${wsp.name}_"/>
 		<param name="externalBLOBs" value="false"/>

> Close Connection when I use PersistenManager and FileSystem with mysql database
> -------------------------------------------------------------------------------
>                 Key: JCR-576
>                 URL: http://issues.apache.org/jira/browse/JCR-576
>             Project: Jackrabbit
>          Issue Type: Improvement
>    Affects Versions: 1.0.1
>         Environment: tomcat  5.5.7
> mysql 5.0
> jackrabbit 1.0.1
>            Reporter: Jorge Rodríguez Pedrianes
>         Attachments: DatabaseFileSystem.java, DatabasePersistenceManager.java
> Hello.
>      In this days i was trying to configure jackrabbit with mysql database, but i saw
that connections to database were closed when my application was idle about 8 hours. When
i try to access to application this threw a exception and i needed to restart tomcat to resolve
this problem.  First, I tried to resolve it adding a parameter to url connection (autoReconnect=true),
but this solution isn't successfully.
>     Then i saw your codes (DatabasePersistenceManager.java and DatabaseFileSystem.java)
and i could see the problem: when the connections are closed by the server; the connection
("con" attribute)  isn't restarted. So, I added a checkConnection Method, this method is add
in all methods that need conection: 
>     protected void checkConnection() throws FileSystemException {
>     	if (checkValidConnectionSQL == null) {
>     		return;
>     	}
>     	try {
> 		checkConnection.executeQuery();
> 		} catch (SQLException e) {
> 			log.warn("Restart connection, ErrorCode= \"" + e.getErrorCode()+ "\"");
> 			initialized = false;
> 			init();
> 			e.printStackTrace();
> 		}
>     }
>     I think that this improvement it's very interesting to avoid restart connections
when are necesary
> Thanks:
>         Jorge Rodríguez Pedrianes

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message