How to use JNDI Database bpool for JDBCStore sessio persistence

609 views Asked by At

I am using JDBCStore to store sessions in MySQL. It is working fine but the default configuration options don't appear to support a database pool (available via a JDBC JNDI resource).

is it possible to use a JNDI JDBC resource for the JDBC Persistence Manager so the container doesn't have to create a new connection each time it needs to persist or retrieve the session data?

Cheers, Steve

1

There are 1 answers

1
jucahoca On

Try the follow code:

<Manager className="org.apache.catalina.session.PersistentManager" 
                     saveOnRestart="true" 
                     maxActiveSessions="-1" 
                     minIdleSwap="-1" 
                     maxIdleSwap="10" 
                     maxIdleBackup="10">
            <Store className="org.apache.catalina.session.JDBCStore"
                dataSourceName="jdbc/intra_gcc"
                checkInterval="30"
                sessionTable="sesion$tomcat"
                sessionAppCol="sesapp"
                sessionIdCol="idses"
                sessionDataCol="datsession"
                sessionValidCol="valid"
                sessionMaxInactiveCol="maxinactive"
                sessionLastAccessedCol="ultaccess"/>
</Manager> 

dataSourceName is a previous JNDI resource name.