Bug 51264 - Context/Manager/Store configuration proposal
Context/Manager/Store configuration proposal
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
trunk
All All
: P2 enhancement (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
: 47061 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2011-05-25 10:48 UTC by gjblajian
Modified: 2011-06-07 19:29 UTC (History)
1 user (show)



Attachments
Implements configuration option for jndi based DataSource. (4.46 KB, patch)
2011-05-28 14:34 UTC, Felix Schumacher
Details | Diff
return pooled connections as early as poosible (4.41 KB, patch)
2011-06-07 13:28 UTC, Felix Schumacher
Details | Diff
return pooled connections as early as poosible (7.06 KB, patch)
2011-06-07 15:21 UTC, Felix Schumacher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description gjblajian 2011-05-25 10:48:09 UTC
Why is it the Persistent Store Store element does not contain a means to reference a database link defined in the globalnamingresources, for example:

This is what is required

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/App1" docbase=" App1" reloadable="false" crossContext="true" debug="1">
    <Manager className="org.apache.catalina.session.PersistentManager" distributable="true" maxIdleBackup="5">
      <Store className="org.apache.catalina.session.JDBCStore" connectionURL="jdbc:oracle:thin:username/password@servername:port:schema"
        driverName="oracle.jdbc.OracleDriver" sessionAppCol="app_name" sessionDataCol="session_data" 
        sessionIdCol="session_id" sessionLastAccessedCol="last_access" sessionMaxInactiveCol="max_inactive"
        sessionTable="tomcat_sessions" sessionValidCol="valid_session" />
    </Manager>
    <ResourceLink global="jdbc/dbName" name="jdbc/dbName" type="javax.sql.DataSource"/>
</Context>

BUT couldn’t the tomcat accept this?

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/App1" docbase=" App1" reloadable="false" crossContext="true" debug="1">
    <Manager className="org.apache.catalina.session.PersistentManager" distributable="true" maxIdleBackup="5">
      <Store className="org.apache.catalina.session.JDBCStore" resourceLink="jdbc/dbName"
        resourceType="javax.sql.DataSource" sessionAppCol="app_name" sessionDataCol="session_data" 
        sessionIdCol="session_id" sessionLastAccessedCol="last_access" sessionMaxInactiveCol="max_inactive"
        sessionTable="tomcat_sessions" sessionValidCol="valid_session" />
    </Manager>
    <ResourceLink global="jdbc/dbName" name="jdbc/dbName" type="javax.sql.DataSource"/>
</Context>

That way the application developer does not need to know the username and password to the production database server nor does it need to be packaged in his/her war file.
Comment 1 Mark Thomas 2011-05-25 11:14:25 UTC
Patches welcome.
Comment 2 Felix Schumacher 2011-05-28 14:34:24 UTC
Created attachment 27084 [details]
Implements configuration option for jndi based DataSource.

Implements configuration option for jndi based DataSource.

New attribute "dataSourceName" for JDBCStore. If this attribute is set, it will be used to get a DataSource from JNDI. If a DataSource was found, it will be used instead of direct configuration via "connectionURL" and "driverName".
Comment 3 Mark Thomas 2011-06-03 22:13:19 UTC
Many thanks for the patch.

It has been applied to 7.0.x and will be included in 7.0.15 onwards.
Comment 4 Mark Thomas 2011-06-04 17:33:38 UTC
*** Bug 47061 has been marked as a duplicate of this bug. ***
Comment 5 Felix Schumacher 2011-06-07 13:26:37 UTC
Pooled connections should be released as early as possible. Otherwise "removeAbandoned" will likely cause havoc.
Comment 6 Felix Schumacher 2011-06-07 13:28:44 UTC
Created attachment 27125 [details]
return pooled connections as early as poosible
Comment 7 Felix Schumacher 2011-06-07 15:21:51 UTC
Created attachment 27127 [details]
return pooled connections as early as poosible

remove can now reuse a connection.
Comment 8 Mark Thomas 2011-06-07 19:29:10 UTC
Fixed in 7.0.x (with some minor tweaks) and will be in 7.0.16 onwards.