Database Reference
In-Depth Information
saveOnRestart
Whether application sessions survive server restarts. Set it to
true
to have Tomcat
save current sessions when it shuts down (and reload them when it starts up).
maxIdleBackup
The number of seconds before inactive sessions are eligible for being saved to
MySQL. A value of
-1
(the default) means “never.”
maxIdleSwap
The number of seconds before idle sessions should be swapped (saved to MySQL
and passivated out of server memory). A value of
-1
(the default) means “never.”
If not
-1
, the value should be at least as great as
maxIdleBackup
.
minIdleSwap
The number of seconds before idle sessions are eligible to be swapped. A value of
-1
(the default) means “never.” If not
-1
, the value should be less than
maxIdleSwap
.
Within the
<Manager>
element, the
<Store>
element indicates how to connect to the
database server, the names of the database and table for storing session records, and the
names of the columns in the table:
className
The name of a class that implements the
org.apache.catalina.Store
interface.
For JDBC-based storage managers, the value is
org.apache.catalina.ses
sion.JDBCStore
.
driverName
The class name for the JDBC driver. For the Connector/J driver, the value is
com.mysql.jdbc.Driver
.
connectionURL
The URL for connecting to the database server, with characters that are special in
XML properly encoded. The following URL connects to the MySQL server on the
local host, using a database, username, and password of
cookbook
,
cbuser
, and
cbpass
, respectively. Notice that the
&
character that separates the
user
and
pass
word
connection parameters is written as the
&
entity:
jdbc:mysql://localhost/cookbook?user=cbuser&password=cbpass
sessionTable
The table in which to store session records. For our example, this is the
tomcat_ses
sion
table described earlier. (The database that contains the table appears in the
connectionURL
value.)
The remaining
<Store>
attributes in the example indicate the column names in the
session table. These attributes are
sessionIdCol
,
sessionAppCol
,
sessionDataCol
,
sessionValidCol
,
sessionMaxInactiveCol
, and
sessionLastAccessedCol
, which
correspond in the obvious way to columns of the
tomcat_session
table.