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.
Patches welcome.
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".
Many thanks for the patch. It has been applied to 7.0.x and will be included in 7.0.15 onwards.
*** Bug 47061 has been marked as a duplicate of this bug. ***
Pooled connections should be released as early as possible. Otherwise "removeAbandoned" will likely cause havoc.
Created attachment 27125 [details] return pooled connections as early as poosible
Created attachment 27127 [details] return pooled connections as early as poosible remove can now reuse a connection.
Fixed in 7.0.x (with some minor tweaks) and will be in 7.0.16 onwards.