Package org.apache.catalina.session
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 SummaryNested classes/interfaces inherited from interface org.apache.catalina.LifecycleLifecycle.SingleUse
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected StringDeprecated.The connection username to use when trying to connect to the database.protected StringDeprecated.The connection URL to use when trying to connect to the database.protected StringDeprecated.Connection string to use when connecting to the DB.protected DataSourceDeprecated.DataSource to useprotected StringDeprecated.name of the JNDI resourceprotected DriverDeprecated.Instance of the JDBC Driver class we use as a connection factory.protected StringDeprecated.Driver to use.protected PreparedStatementDeprecated.Variable to hold theclear()prepared statement.protected PreparedStatementDeprecated.Variable to hold theload()prepared statement.protected PreparedStatementDeprecated.Variable to hold theremove()prepared statement.protected PreparedStatementDeprecated.Variable to hold thesave()prepared statement.protected PreparedStatementDeprecated.Variable to hold thegetSize()prepared statement.protected StringDeprecated.Column to use for /Engine/Host/Context nameprotected StringDeprecated.Data column to use.protected StringDeprecated.Id column to use.protected StringDeprecated.Last Accessed column to use.protected StringDeprecated.Max Inactive column to use.protected StringDeprecated.Table to use.protected StringDeprecated.Is Validcolumn to use.protected static final StringDeprecated.Name to register for this Store, used for logging.protected static final StringDeprecated.Name to register for the background thread.Fields inherited from interface org.apache.catalina.LifecycleAFTER_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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Deprecated.Remove all of the Sessions in this Store.protected voidclose(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 ConnectionDeprecated.Check the connection associated with this store, if it'snullor closed try to reopen it.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.booleanDeprecated.getName()Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.intgetSize()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 Connectionopen()Deprecated.Open (if necessary) and return a database connection for use by this Store.protected voidrelease(Connection conn) Deprecated.Release the connection, if it is associated with a connection pool.voidDeprecated.Remove the Session with the specified session identifier from this Store, if present.voidDeprecated.Save a session to the Store.voidsetConnectionName(String connectionName) Deprecated.Set the username to use to connect to the database.voidsetConnectionPassword(String connectionPassword) Deprecated.Set the password to use to connect to the database.voidsetConnectionURL(String connectionURL) Deprecated.Set the Connection URL for this Store.voidsetDataSourceName(String dataSourceName) Deprecated.Set the JNDI name of a DataSource-factory to use for db accessvoidsetDriverName(String driverName) Deprecated.Set the driver for this Store.voidsetLocalDataSource(boolean localDataSource) Deprecated.Set totrueto cause the datasource to be looked up in the webapp JNDI Context.voidsetSessionAppCol(String sessionAppCol) Deprecated.Set the App column for the table.voidsetSessionDataCol(String sessionDataCol) Deprecated.Set the Data column for the tablevoidsetSessionIdCol(String sessionIdCol) Deprecated.Set the Id column for the table.voidsetSessionLastAccessedCol(String sessionLastAccessedCol) Deprecated.Set theLast Accessedcolumn for the tablevoidsetSessionMaxInactiveCol(String sessionMaxInactiveCol) Deprecated.Set theMax Inactivecolumn for the tablevoidsetSessionTable(String sessionTable) Deprecated.Set the table for this Store.voidsetSessionValidCol(String sessionValidCol) Deprecated.Set theIs Validcolumn for the tableprotected voidDeprecated.Start this component and implement the requirements ofLifecycleBase.startInternal().protected voidDeprecated.Stop this component and implement the requirements ofLifecycleBase.stopInternal().Methods inherited from class org.apache.catalina.session.StoreBaseaddPropertyChangeListener, destroyInternal, getManager, getObjectInputStream, initInternal, processExpires, removePropertyChangeListener, setManager, toStringMethods inherited from class org.apache.catalina.util.LifecycleBaseaddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
- 
Field Details- 
storeNameDeprecated.Name to register for this Store, used for logging.- See Also:
 
- 
threadNameDeprecated.Name to register for the background thread.- See Also:
 
- 
connectionNameDeprecated.The connection username to use when trying to connect to the database.
- 
connectionPasswordDeprecated.The connection URL to use when trying to connect to the database.
- 
connectionURLDeprecated.Connection string to use when connecting to the DB.
- 
driverDeprecated.Instance of the JDBC Driver class we use as a connection factory.
- 
driverNameDeprecated.Driver to use.
- 
dataSourceNameDeprecated.name of the JNDI resource
- 
dataSourceDeprecated.DataSource to use
- 
sessionTableDeprecated.Table to use.
- 
sessionAppColDeprecated.Column to use for /Engine/Host/Context name
- 
sessionIdColDeprecated.Id column to use.
- 
sessionDataColDeprecated.Data column to use.
- 
sessionValidColDeprecated.Is Validcolumn to use.
- 
sessionMaxInactiveColDeprecated.Max Inactive column to use.
- 
sessionLastAccessedColDeprecated.Last Accessed column to use.
- 
preparedSizeSqlDeprecated.Variable to hold thegetSize()prepared statement.
- 
preparedSaveSqlDeprecated.Variable to hold thesave()prepared statement.
- 
preparedClearSqlDeprecated.Variable to hold theclear()prepared statement.
- 
preparedRemoveSqlDeprecated.Variable to hold theremove()prepared statement.
- 
preparedLoadSqlDeprecated.Variable to hold theload()prepared statement.
 
- 
- 
Constructor Details- 
JDBCStorepublic JDBCStore()Deprecated.
 
- 
- 
Method Details- 
getNameDeprecated.- Returns:
- the name for this instance (built from container name)
 
- 
getThreadNameDeprecated.- Returns:
- the thread name for this Store.
 
- 
getStoreNameDeprecated.- Overrides:
- getStoreNamein class- StoreBase
- Returns:
- the name for this Store, used for logging.
 
- 
setDriverNameDeprecated.Set the driver for this Store.- Parameters:
- driverName- The new driver
 
- 
getDriverNameDeprecated.- Returns:
- the driver for this Store.
 
- 
getConnectionNameDeprecated.- Returns:
- the username to use to connect to the database.
 
- 
setConnectionNameDeprecated.Set the username to use to connect to the database.- Parameters:
- connectionName- Username
 
- 
getConnectionPasswordDeprecated.- Returns:
- the password to use to connect to the database.
 
- 
setConnectionPasswordDeprecated.Set the password to use to connect to the database.- Parameters:
- connectionPassword- User password
 
- 
setConnectionURLDeprecated.Set the Connection URL for this Store.- Parameters:
- connectionURL- The new Connection URL
 
- 
getConnectionURLDeprecated.- Returns:
- the Connection URL for this Store.
 
- 
setSessionTableDeprecated.Set the table for this Store.- Parameters:
- sessionTable- The new table
 
- 
getSessionTableDeprecated.- Returns:
- the table for this Store.
 
- 
setSessionAppColDeprecated.Set the App column for the table.- Parameters:
- sessionAppCol- the column name
 
- 
getSessionAppColDeprecated.- Returns:
- the web application name column for the table.
 
- 
setSessionIdColDeprecated.Set the Id column for the table.- Parameters:
- sessionIdCol- the column name
 
- 
getSessionIdColDeprecated.- Returns:
- the Id column for the table.
 
- 
setSessionDataColDeprecated.Set the Data column for the table- Parameters:
- sessionDataCol- the column name
 
- 
getSessionDataColDeprecated.- Returns:
- the data column for the table
 
- 
setSessionValidColDeprecated.Set theIs Validcolumn for the table- Parameters:
- sessionValidCol- The column name
 
- 
getSessionValidColDeprecated.- Returns:
- the Is Validcolumn
 
- 
setSessionMaxInactiveColDeprecated.Set theMax Inactivecolumn for the table- Parameters:
- sessionMaxInactiveCol- The column name
 
- 
getSessionMaxInactiveColDeprecated.- Returns:
- the Max Inactivecolumn
 
- 
setSessionLastAccessedColDeprecated.Set theLast Accessedcolumn for the table- Parameters:
- sessionLastAccessedCol- The column name
 
- 
getSessionLastAccessedColDeprecated.- Returns:
- the Last Accessedcolumn
 
- 
setDataSourceNameDeprecated.Set the JNDI name of a DataSource-factory to use for db access- Parameters:
- dataSourceName- The JNDI name of the DataSource-factory
 
- 
getDataSourceNameDeprecated.- Returns:
- the name of the JNDI DataSource-factory
 
- 
getLocalDataSourcepublic boolean getLocalDataSource()Deprecated.- Returns:
- if the datasource will be looked up in the webapp JNDI Context.
 
- 
setLocalDataSourcepublic void setLocalDataSource(boolean localDataSource) Deprecated.Set totrueto cause the datasource to be looked up in the webapp JNDI Context.- Parameters:
- localDataSource- the new flag value
 
- 
expiredKeysDeprecated.Description copied from class:StoreBaseGet only those keys of sessions, that are saved in the Store and are to be expired.- Overrides:
- expiredKeysin class- StoreBase
- Returns:
- list of session keys, that are to be expired
- Throws:
- IOException- if an input-/output error occurred
 
- 
keysDeprecated.- 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
 
- 
getSizeDeprecated.Return an integer containing a count of all Sessions currently saved in this Store. If there are no Sessions,0is returned.- Returns:
- the count of all sessions currently saved in this Store
- Throws:
- IOException- if an input/output error occurred
 
- 
loadDeprecated.Load the Session associated with the idid. If no such session is foundnullis returned.- Parameters:
- id- a value of type- String
- Returns:
- the stored Session
- Throws:
- ClassNotFoundException- if an error occurs
- IOException- if an input/output error occurred
 
- 
removeDeprecated.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
 
- 
clearDeprecated.Remove all of the Sessions in this Store.- Throws:
- IOException- if an input/output error occurs
 
- 
saveDeprecated.Save a session to the Store.- Parameters:
- session- the session to be stored
- Throws:
- IOException- if an input/output error occurs
 
- 
getConnectionDeprecated.Check the connection associated with this store, if it'snullor closed try to reopen it. Returnsnullif the connection could not be established.- Returns:
- Connectionif the connection succeeded
 
- 
openDeprecated.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
 
- 
closeDeprecated.Close the specified database connection.- Parameters:
- dbConnection- The connection to be closed
 
- 
releaseDeprecated.Release the connection, if it is associated with a connection pool.- Parameters:
- conn- The connection to be released
 
- 
startInternalDeprecated.Start this component and implement the requirements ofLifecycleBase.startInternal().- Overrides:
- startInternalin class- StoreBase
- Throws:
- LifecycleException- if this component detects a fatal error that prevents this component from being used
 
- 
stopInternalDeprecated.Stop this component and implement the requirements ofLifecycleBase.stopInternal().- Overrides:
- stopInternalin class- StoreBase
- Throws:
- LifecycleException- if this component detects a fatal error that prevents this component from being used
 
 
-