Class JDBCStore
java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.session.StoreBase
org.apache.catalina.session.JDBCStore
- Direct Known Subclasses:
DataSourceStore
Deprecated.
Removed in Tomcat 10 and replaced by DataSourceStore with removal of legacy JDBC code
Implementation of the
Store
interface that stores serialized session objects in a
database. Sessions that are saved are still subject to being expired based on inactivity.- Author:
- Bip Thelin
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle
Lifecycle.SingleUse
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
Deprecated.The connection username to use when trying to connect to the database.protected String
Deprecated.The connection URL to use when trying to connect to the database.protected String
Deprecated.Connection string to use when connecting to the DB.protected DataSource
Deprecated.DataSource to useprotected String
Deprecated.name of the JNDI resourceprotected Driver
Deprecated.Instance of the JDBC Driver class we use as a connection factory.protected String
Deprecated.Driver to use.protected PreparedStatement
Deprecated.Variable to hold theclear()
prepared statement.protected PreparedStatement
Deprecated.Variable to hold theload()
prepared statement.protected PreparedStatement
Deprecated.Variable to hold theremove()
prepared statement.protected PreparedStatement
Deprecated.Variable to hold thesave()
prepared statement.protected PreparedStatement
Deprecated.Variable to hold thegetSize()
prepared statement.protected String
Deprecated.Column to use for /Engine/Host/Context nameprotected String
Deprecated.Data column to use.protected String
Deprecated.Id column to use.protected String
Deprecated.Last Accessed column to use.protected String
Deprecated.Max Inactive column to use.protected String
Deprecated.Table to use.protected String
Deprecated.Is Valid
column to use.protected static final String
Deprecated.Name to register for this Store, used for logging.protected static final String
Deprecated.Name to register for the background thread.Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Deprecated.Remove all of the Sessions in this Store.protected void
close
(Connection dbConnection) Deprecated.Close the specified database connection.String[]
Deprecated.Get only those keys of sessions, that are saved in the Store and are to be expired.protected Connection
Deprecated.Check the connection associated with this store, if it'snull
or closed try to reopen it.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.boolean
Deprecated.getName()
Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.int
getSize()
Deprecated.Return an integer containing a count of all Sessions currently saved in this Store.Deprecated.Deprecated.String[]
keys()
Deprecated.Deprecated.Load the Session associated with the idid
.protected Connection
open()
Deprecated.Open (if necessary) and return a database connection for use by this Store.protected void
release
(Connection conn) Deprecated.Release the connection, if it is associated with a connection pool.void
Deprecated.Remove the Session with the specified session identifier from this Store, if present.void
Deprecated.Save a session to the Store.void
setConnectionName
(String connectionName) Deprecated.Set the username to use to connect to the database.void
setConnectionPassword
(String connectionPassword) Deprecated.Set the password to use to connect to the database.void
setConnectionURL
(String connectionURL) Deprecated.Set the Connection URL for this Store.void
setDataSourceName
(String dataSourceName) Deprecated.Set the JNDI name of a DataSource-factory to use for db accessvoid
setDriverName
(String driverName) Deprecated.Set the driver for this Store.void
setLocalDataSource
(boolean localDataSource) Deprecated.Set totrue
to cause the datasource to be looked up in the webapp JNDI Context.void
setSessionAppCol
(String sessionAppCol) Deprecated.Set the App column for the table.void
setSessionDataCol
(String sessionDataCol) Deprecated.Set the Data column for the tablevoid
setSessionIdCol
(String sessionIdCol) Deprecated.Set the Id column for the table.void
setSessionLastAccessedCol
(String sessionLastAccessedCol) Deprecated.Set theLast Accessed
column for the tablevoid
setSessionMaxInactiveCol
(String sessionMaxInactiveCol) Deprecated.Set theMax Inactive
column for the tablevoid
setSessionTable
(String sessionTable) Deprecated.Set the table for this Store.void
setSessionValidCol
(String sessionValidCol) Deprecated.Set theIs Valid
column for the tableprotected void
Deprecated.Start this component and implement the requirements ofLifecycleBase.startInternal()
.protected void
Deprecated.Stop this component and implement the requirements ofLifecycleBase.stopInternal()
.Methods inherited from class org.apache.catalina.session.StoreBase
addPropertyChangeListener, destroyInternal, getManager, getObjectInputStream, initInternal, processExpires, removePropertyChangeListener, setManager, toString
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
-
Field Details
-
storeName
Deprecated.Name to register for this Store, used for logging.- See Also:
-
threadName
Deprecated.Name to register for the background thread.- See Also:
-
connectionName
Deprecated.The connection username to use when trying to connect to the database. -
connectionPassword
Deprecated.The connection URL to use when trying to connect to the database. -
connectionURL
-
driver
Deprecated.Instance of the JDBC Driver class we use as a connection factory. -
driverName
-
dataSourceName
-
dataSource
-
sessionTable
-
sessionAppCol
-
sessionIdCol
-
sessionDataCol
-
sessionValidCol
-
sessionMaxInactiveCol
-
sessionLastAccessedCol
-
preparedSizeSql
Deprecated.Variable to hold thegetSize()
prepared statement. -
preparedSaveSql
Deprecated.Variable to hold thesave()
prepared statement. -
preparedClearSql
Deprecated.Variable to hold theclear()
prepared statement. -
preparedRemoveSql
Deprecated.Variable to hold theremove()
prepared statement. -
preparedLoadSql
Deprecated.Variable to hold theload()
prepared statement.
-
-
Constructor Details
-
JDBCStore
public JDBCStore()Deprecated.
-
-
Method Details
-
getName
-
getThreadName
-
getStoreName
Deprecated.- Overrides:
getStoreName
in classStoreBase
- Returns:
- the name for this Store, used for logging.
-
setDriverName
Deprecated.Set the driver for this Store.- Parameters:
driverName
- The new driver
-
getDriverName
-
getConnectionName
Deprecated.- Returns:
- the username to use to connect to the database.
-
setConnectionName
Deprecated.Set the username to use to connect to the database.- Parameters:
connectionName
- Username
-
getConnectionPassword
Deprecated.- Returns:
- the password to use to connect to the database.
-
setConnectionPassword
Deprecated.Set the password to use to connect to the database.- Parameters:
connectionPassword
- User password
-
setConnectionURL
Deprecated.Set the Connection URL for this Store.- Parameters:
connectionURL
- The new Connection URL
-
getConnectionURL
-
setSessionTable
Deprecated.Set the table for this Store.- Parameters:
sessionTable
- The new table
-
getSessionTable
-
setSessionAppCol
Deprecated.Set the App column for the table.- Parameters:
sessionAppCol
- the column name
-
getSessionAppCol
Deprecated.- Returns:
- the web application name column for the table.
-
setSessionIdCol
Deprecated.Set the Id column for the table.- Parameters:
sessionIdCol
- the column name
-
getSessionIdCol
-
setSessionDataCol
Deprecated.Set the Data column for the table- Parameters:
sessionDataCol
- the column name
-
getSessionDataCol
-
setSessionValidCol
Deprecated.Set theIs Valid
column for the table- Parameters:
sessionValidCol
- The column name
-
getSessionValidCol
-
setSessionMaxInactiveCol
Deprecated.Set theMax Inactive
column for the table- Parameters:
sessionMaxInactiveCol
- The column name
-
getSessionMaxInactiveCol
-
setSessionLastAccessedCol
Deprecated.Set theLast Accessed
column for the table- Parameters:
sessionLastAccessedCol
- The column name
-
getSessionLastAccessedCol
-
setDataSourceName
Deprecated.Set the JNDI name of a DataSource-factory to use for db access- Parameters:
dataSourceName
- The JNDI name of the DataSource-factory
-
getDataSourceName
-
getLocalDataSource
public boolean getLocalDataSource()Deprecated.- Returns:
- if the datasource will be looked up in the webapp JNDI Context.
-
setLocalDataSource
public void setLocalDataSource(boolean localDataSource) Deprecated.Set totrue
to cause the datasource to be looked up in the webapp JNDI Context.- Parameters:
localDataSource
- the new flag value
-
expiredKeys
Deprecated.Description copied from class:StoreBase
Get only those keys of sessions, that are saved in the Store and are to be expired.- Overrides:
expiredKeys
in classStoreBase
- Returns:
- array of session keys, that are to be expired
- Throws:
IOException
- if an input-/output error occurred
-
keys
Deprecated.- Returns:
- an array containing the session identifiers of all Sessions currently saved in this Store. If there are no such Sessions, a zero-length array is returned.
- Throws:
IOException
- if an input/output error occurred
-
getSize
Deprecated.Return an integer containing a count of all Sessions currently saved in this Store. If there are no Sessions,0
is returned.- Returns:
- the count of all sessions currently saved in this Store
- Throws:
IOException
- if an input/output error occurred
-
load
Deprecated.Load the Session associated with the idid
. If no such session is foundnull
is returned.- Parameters:
id
- a value of typeString
- Returns:
- the stored
Session
- Throws:
ClassNotFoundException
- if an error occursIOException
- if an input/output error occurred
-
remove
Deprecated.Remove the Session with the specified session identifier from this Store, if present. If no such Session is present, this method takes no action.- Parameters:
id
- Session identifier of the Session to be removed- Throws:
IOException
- if an input/output error occurs
-
clear
Deprecated.Remove all of the Sessions in this Store.- Throws:
IOException
- if an input/output error occurs
-
save
Deprecated.Save a session to the Store.- Parameters:
session
- the session to be stored- Throws:
IOException
- if an input/output error occurs
-
getConnection
Deprecated.Check the connection associated with this store, if it'snull
or closed try to reopen it. Returnsnull
if the connection could not be established.- Returns:
Connection
if the connection succeeded
-
open
Deprecated.Open (if necessary) and return a database connection for use by this Store.- Returns:
- database connection ready to use
- Throws:
SQLException
- if a database error occurs
-
close
Deprecated.Close the specified database connection.- Parameters:
dbConnection
- The connection to be closed
-
release
Deprecated.Release the connection, if it is associated with a connection pool.- Parameters:
conn
- The connection to be released
-
startInternal
Deprecated.Start this component and implement the requirements ofLifecycleBase.startInternal()
.- Overrides:
startInternal
in classStoreBase
- Throws:
LifecycleException
- if this component detects a fatal error that prevents this component from being used
-
stopInternal
Deprecated.Stop this component and implement the requirements ofLifecycleBase.stopInternal()
.- Overrides:
stopInternal
in classStoreBase
- Throws:
LifecycleException
- if this component detects a fatal error that prevents this component from being used
-