You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Eddie Yee <ed...@hotmail.com> on 2009/03/27 16:23:11 UTC

Session Persistence via JDBCStore

Hi,

 

I currently use deployment descriptor xml files to describe both the war file to deployed and the session persistence info (configs+db info).  Currently we use a connectionURL that specifies db complete db info (user/pass/db/port/sid)--  I would like to know if I can specify a datasource specified in the server.xml instead, and how to specify it (if you could provide an example, that'd be great).

 

Here's an example of my current deployment descriptor:

mywar.xml

 

        <Context
            path="/mywar"
            docBase="/nas1/tomcat/apps/mywar.war">
          <Manager className="org.apache.catalina.session.PersistentManager"
              maxIdleBackup="1"
              maxIdleSwap="1780"
              maxInactiveInterval="1800"
              minIdleSwap="1750"
              processExpiresFrequency="1">
            <Store className="org.apache.catalina.session.JDBCStore"
              connectionURL="jdbc:oracle:thin:user/password@mydberver.mydomain.com:1521:DBSID"
              driverName="oracle.jdbc.driver.OracleDriver"
              sessionAppCol="app_context"
              sessionDataCol="session_data"
              sessionIdCol="session_id"
              sessionLastAccessedCol="last_access"
              sessionMaxInactiveCol="max_inactive"
              sessionTable="tomcat_sessions"
              sessionValidCol="valid_session"/>
          </Manager>
        </Context>


 

Thanks!!!

Eddie

_________________________________________________________________
Express your personality in color! Preview and select themes for Hotmail®.
http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=TXT_MSGTX_WL_HM_express_032009#colortheme

RE: Session Persistence via JDBCStore

Posted by Eddie Yee <ed...@hotmail.com>.
Ya, right now it's a really big pain in the rear to maintain all these extra configs, especially when we jump between different databases when they go under maintenance, and multiply that between the number of applications we have now...  

 

If anybody else knows a way around this, I'd appreciate it.

 

> Hi Eddie,
> 
> I'm not sure if this would be possible with the default JDBCStore
> shipped with tomcat
> since the org.apache.catalina.session.JDBCStore is not considering
> usage of datasources
> which would certainly be a good plus, but maybe there is a reason why
> it is not in there.
> 
> if some one else have a clue i'm interested to know how this work.
> 


_________________________________________________________________
Hotmail® is up to 70% faster. Now good news travels really fast.
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009

Re: Session Persistence via JDBCStore

Posted by Yassine <el...@users.sourceforge.net>.
Hi Eddie,

I'm not sure if this would be possible with the default JDBCStore
shipped with tomcat
since the org.apache.catalina.session.JDBCStore is not considering
usage of datasources
which would certainly be a good plus, but maybe there is a reason why
it is not in there.

if some one else have a clue i'm interested to know how this work.


On Fri, Mar 27, 2009 at 4:23 PM, Eddie Yee <ed...@hotmail.com> wrote:
>
> Hi,
>
>
>
> I currently use deployment descriptor xml files to describe both the war file to deployed and the session persistence info (configs+db info).  Currently we use a connectionURL that specifies db complete db info (user/pass/db/port/sid)--  I would like to know if I can specify a datasource specified in the server.xml instead, and how to specify it (if you could provide an example, that'd be great).
>
>
>
> Here's an example of my current deployment descriptor:
>
> mywar.xml
>
>
>
>        <Context
>            path="/mywar"
>            docBase="/nas1/tomcat/apps/mywar.war">
>          <Manager className="org.apache.catalina.session.PersistentManager"
>              maxIdleBackup="1"
>              maxIdleSwap="1780"
>              maxInactiveInterval="1800"
>              minIdleSwap="1750"
>              processExpiresFrequency="1">
>            <Store className="org.apache.catalina.session.JDBCStore"
>              connectionURL="jdbc:oracle:thin:user/password@mydberver.mydomain.com:1521:DBSID"
>              driverName="oracle.jdbc.driver.OracleDriver"
>              sessionAppCol="app_context"
>              sessionDataCol="session_data"
>              sessionIdCol="session_id"
>              sessionLastAccessedCol="last_access"
>              sessionMaxInactiveCol="max_inactive"
>              sessionTable="tomcat_sessions"
>              sessionValidCol="valid_session"/>
>          </Manager>
>        </Context>
>
>
>
>
> Thanks!!!
>
> Eddie
>
> _________________________________________________________________
> Express your personality in color! Preview and select themes for Hotmail®.
> http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=TXT_MSGTX_WL_HM_express_032009#colortheme



-- 
--
Yassine Elassad
Bonn, Germany.
Fon : +49 228 97629355
Mobile : +49 157 74519666

PEACE :
( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Session Persistence via JDBCStore

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eddie,

On 3/27/2009 11:23 AM, Eddie Yee wrote:
> I currently use deployment descriptor xml files to describe both the
> war file to deployed and the session persistence info (configs+db
> info).  Currently we use a connectionURL that specifies db complete
> db info (user/pass/db/port/sid)--  I would like to know if I can
> specify a datasource specified in the server.xml instead, and how to
> specify it (if you could provide an example, that'd be great).

Unfortunately, JDBCStore does not support the use of DataSources. I
would have recommended that you just subclass JDBCStore and override the
'open' method, but it looks like that class (like it's brother
JDBCRealm) caches PreparedStatement objects so you might have do to a
bunch of work to subclass... perhaps just copying that class and doing a
hack-job on it would work.

If you were to write something like this, consider contributing it back
to the community... I'm sure some people out there would like to use a
JDBCDataSourceStore instead of the JDBCStore.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAknM9QMACgkQ9CaO5/Lv0PC2jACghE0mGGOl1FgE8ZVqvVzfNLn3
QUwAoIhdx6JPOxRSf+7Zd8XOCI8JDbV7
=sduq
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org