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 public class JDBCStore extends StoreBase Deprecated.Removed in Tomcat 10 and replaced by DataSourceStore with removal of legacy JDBC codeImplementation of theStoreinterface 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.LifecycleLifecycle.SingleUse
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected java.lang.StringconnectionNameDeprecated.The connection username to use when trying to connect to the database.protected java.lang.StringconnectionPasswordDeprecated.The connection URL to use when trying to connect to the database.protected java.lang.StringconnectionURLDeprecated.Connection string to use when connecting to the DB.protected javax.sql.DataSourcedataSourceDeprecated.DataSource to useprotected java.lang.StringdataSourceNameDeprecated.name of the JNDI resourceprotected java.sql.DriverdriverDeprecated.Instance of the JDBC Driver class we use as a connection factory.protected java.lang.StringdriverNameDeprecated.Driver to use.protected java.sql.PreparedStatementpreparedClearSqlDeprecated.Variable to hold theclear()prepared statement.protected java.sql.PreparedStatementpreparedLoadSqlDeprecated.Variable to hold theload()prepared statement.protected java.sql.PreparedStatementpreparedRemoveSqlDeprecated.Variable to hold theremove()prepared statement.protected java.sql.PreparedStatementpreparedSaveSqlDeprecated.Variable to hold thesave()prepared statement.protected java.sql.PreparedStatementpreparedSizeSqlDeprecated.Variable to hold thegetSize()prepared statement.protected java.lang.StringsessionAppColDeprecated.Column to use for /Engine/Host/Context nameprotected java.lang.StringsessionDataColDeprecated.Data column to use.protected java.lang.StringsessionIdColDeprecated.Id column to use.protected java.lang.StringsessionLastAccessedColDeprecated.Last Accessed column to use.protected java.lang.StringsessionMaxInactiveColDeprecated.Max Inactive column to use.protected java.lang.StringsessionTableDeprecated.Table to use.protected java.lang.StringsessionValidColDeprecated.Is Validcolumn to use.protected static java.lang.StringstoreNameDeprecated.Name to register for this Store, used for logging.protected static java.lang.StringthreadNameDeprecated.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 Constructor Description JDBCStore()Deprecated.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclear()Deprecated.Remove all of the Sessions in this Store.protected voidclose(java.sql.Connection dbConnection)Deprecated.Close the specified database connection.java.lang.String[]expiredKeys()Deprecated.Get only those keys of sessions, that are saved in the Store and are to be expired.protected java.sql.ConnectiongetConnection()Deprecated.Check the connection associated with this store, if it'snullor closed try to reopen it.java.lang.StringgetConnectionName()Deprecated.java.lang.StringgetConnectionPassword()Deprecated.java.lang.StringgetConnectionURL()Deprecated.java.lang.StringgetDataSourceName()Deprecated.java.lang.StringgetDriverName()Deprecated.booleangetLocalDataSource()Deprecated.java.lang.StringgetName()Deprecated.java.lang.StringgetSessionAppCol()Deprecated.java.lang.StringgetSessionDataCol()Deprecated.java.lang.StringgetSessionIdCol()Deprecated.java.lang.StringgetSessionLastAccessedCol()Deprecated.java.lang.StringgetSessionMaxInactiveCol()Deprecated.java.lang.StringgetSessionTable()Deprecated.java.lang.StringgetSessionValidCol()Deprecated.intgetSize()Deprecated.Return an integer containing a count of all Sessions currently saved in this Store.java.lang.StringgetStoreName()Deprecated.java.lang.StringgetThreadName()Deprecated.java.lang.String[]keys()Deprecated.Sessionload(java.lang.String id)Deprecated.Load the Session associated with the idid.protected java.sql.Connectionopen()Deprecated.Open (if necessary) and return a database connection for use by this Store.protected voidrelease(java.sql.Connection conn)Deprecated.Release the connection, if it is associated with a connection pool.voidremove(java.lang.String id)Deprecated.Remove the Session with the specified session identifier from this Store, if present.voidsave(Session session)Deprecated.Save a session to the Store.voidsetConnectionName(java.lang.String connectionName)Deprecated.Set the username to use to connect to the database.voidsetConnectionPassword(java.lang.String connectionPassword)Deprecated.Set the password to use to connect to the database.voidsetConnectionURL(java.lang.String connectionURL)Deprecated.Set the Connection URL for this Store.voidsetDataSourceName(java.lang.String dataSourceName)Deprecated.Set the JNDI name of a DataSource-factory to use for db accessvoidsetDriverName(java.lang.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(java.lang.String sessionAppCol)Deprecated.Set the App column for the table.voidsetSessionDataCol(java.lang.String sessionDataCol)Deprecated.Set the Data column for the tablevoidsetSessionIdCol(java.lang.String sessionIdCol)Deprecated.Set the Id column for the table.voidsetSessionLastAccessedCol(java.lang.String sessionLastAccessedCol)Deprecated.Set theLast Accessedcolumn for the tablevoidsetSessionMaxInactiveCol(java.lang.String sessionMaxInactiveCol)Deprecated.Set theMax Inactivecolumn for the tablevoidsetSessionTable(java.lang.String sessionTable)Deprecated.Set the table for this Store.voidsetSessionValidCol(java.lang.String sessionValidCol)Deprecated.Set theIs Validcolumn for the tableprotected voidstartInternal()Deprecated.Start this component and implement the requirements ofLifecycleBase.startInternal().protected voidstopInternal()Deprecated.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, toString
 - 
Methods inherited from class org.apache.catalina.util.LifecycleBaseaddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
 
- 
 
- 
- 
- 
Field Detail- 
storeNameprotected static final java.lang.String storeName Deprecated.Name to register for this Store, used for logging.- See Also:
- Constant Field Values
 
 - 
threadNameprotected static final java.lang.String threadName Deprecated.Name to register for the background thread.- See Also:
- Constant Field Values
 
 - 
connectionNameprotected java.lang.String connectionName Deprecated.The connection username to use when trying to connect to the database.
 - 
connectionPasswordprotected java.lang.String connectionPassword Deprecated.The connection URL to use when trying to connect to the database.
 - 
connectionURLprotected java.lang.String connectionURL Deprecated.Connection string to use when connecting to the DB.
 - 
driverprotected java.sql.Driver driver Deprecated.Instance of the JDBC Driver class we use as a connection factory.
 - 
driverNameprotected java.lang.String driverName Deprecated.Driver to use.
 - 
dataSourceNameprotected java.lang.String dataSourceName Deprecated.name of the JNDI resource
 - 
dataSourceprotected javax.sql.DataSource dataSource Deprecated.DataSource to use
 - 
sessionTableprotected java.lang.String sessionTable Deprecated.Table to use.
 - 
sessionAppColprotected java.lang.String sessionAppCol Deprecated.Column to use for /Engine/Host/Context name
 - 
sessionIdColprotected java.lang.String sessionIdCol Deprecated.Id column to use.
 - 
sessionDataColprotected java.lang.String sessionDataCol Deprecated.Data column to use.
 - 
sessionValidColprotected java.lang.String sessionValidCol Deprecated.Is Validcolumn to use.
 - 
sessionMaxInactiveColprotected java.lang.String sessionMaxInactiveCol Deprecated.Max Inactive column to use.
 - 
sessionLastAccessedColprotected java.lang.String sessionLastAccessedCol Deprecated.Last Accessed column to use.
 - 
preparedSizeSqlprotected java.sql.PreparedStatement preparedSizeSql Deprecated.Variable to hold thegetSize()prepared statement.
 - 
preparedSaveSqlprotected java.sql.PreparedStatement preparedSaveSql Deprecated.Variable to hold thesave()prepared statement.
 - 
preparedClearSqlprotected java.sql.PreparedStatement preparedClearSql Deprecated.Variable to hold theclear()prepared statement.
 - 
preparedRemoveSqlprotected java.sql.PreparedStatement preparedRemoveSql Deprecated.Variable to hold theremove()prepared statement.
 - 
preparedLoadSqlprotected java.sql.PreparedStatement preparedLoadSql Deprecated.Variable to hold theload()prepared statement.
 
- 
 - 
Method Detail- 
getNamepublic java.lang.String getName() Deprecated.- Returns:
- the name for this instance (built from container name)
 
 - 
getThreadNamepublic java.lang.String getThreadName() Deprecated.- Returns:
- the thread name for this Store.
 
 - 
getStoreNamepublic java.lang.String getStoreName() Deprecated.- Overrides:
- getStoreNamein class- StoreBase
- Returns:
- the name for this Store, used for logging.
 
 - 
setDriverNamepublic void setDriverName(java.lang.String driverName) Deprecated.Set the driver for this Store.- Parameters:
- driverName- The new driver
 
 - 
getDriverNamepublic java.lang.String getDriverName() Deprecated.- Returns:
- the driver for this Store.
 
 - 
getConnectionNamepublic java.lang.String getConnectionName() Deprecated.- Returns:
- the username to use to connect to the database.
 
 - 
setConnectionNamepublic void setConnectionName(java.lang.String connectionName) Deprecated.Set the username to use to connect to the database.- Parameters:
- connectionName- Username
 
 - 
getConnectionPasswordpublic java.lang.String getConnectionPassword() Deprecated.- Returns:
- the password to use to connect to the database.
 
 - 
setConnectionPasswordpublic void setConnectionPassword(java.lang.String connectionPassword) Deprecated.Set the password to use to connect to the database.- Parameters:
- connectionPassword- User password
 
 - 
setConnectionURLpublic void setConnectionURL(java.lang.String connectionURL) Deprecated.Set the Connection URL for this Store.- Parameters:
- connectionURL- The new Connection URL
 
 - 
getConnectionURLpublic java.lang.String getConnectionURL() Deprecated.- Returns:
- the Connection URL for this Store.
 
 - 
setSessionTablepublic void setSessionTable(java.lang.String sessionTable) Deprecated.Set the table for this Store.- Parameters:
- sessionTable- The new table
 
 - 
getSessionTablepublic java.lang.String getSessionTable() Deprecated.- Returns:
- the table for this Store.
 
 - 
setSessionAppColpublic void setSessionAppCol(java.lang.String sessionAppCol) Deprecated.Set the App column for the table.- Parameters:
- sessionAppCol- the column name
 
 - 
getSessionAppColpublic java.lang.String getSessionAppCol() Deprecated.- Returns:
- the web application name column for the table.
 
 - 
setSessionIdColpublic void setSessionIdCol(java.lang.String sessionIdCol) Deprecated.Set the Id column for the table.- Parameters:
- sessionIdCol- the column name
 
 - 
getSessionIdColpublic java.lang.String getSessionIdCol() Deprecated.- Returns:
- the Id column for the table.
 
 - 
setSessionDataColpublic void setSessionDataCol(java.lang.String sessionDataCol) Deprecated.Set the Data column for the table- Parameters:
- sessionDataCol- the column name
 
 - 
getSessionDataColpublic java.lang.String getSessionDataCol() Deprecated.- Returns:
- the data column for the table
 
 - 
setSessionValidColpublic void setSessionValidCol(java.lang.String sessionValidCol) Deprecated.Set theIs Validcolumn for the table- Parameters:
- sessionValidCol- The column name
 
 - 
getSessionValidColpublic java.lang.String getSessionValidCol() Deprecated.- Returns:
- the Is Validcolumn
 
 - 
setSessionMaxInactiveColpublic void setSessionMaxInactiveCol(java.lang.String sessionMaxInactiveCol) Deprecated.Set theMax Inactivecolumn for the table- Parameters:
- sessionMaxInactiveCol- The column name
 
 - 
getSessionMaxInactiveColpublic java.lang.String getSessionMaxInactiveCol() Deprecated.- Returns:
- the Max Inactivecolumn
 
 - 
setSessionLastAccessedColpublic void setSessionLastAccessedCol(java.lang.String sessionLastAccessedCol) Deprecated.Set theLast Accessedcolumn for the table- Parameters:
- sessionLastAccessedCol- The column name
 
 - 
getSessionLastAccessedColpublic java.lang.String getSessionLastAccessedCol() Deprecated.- Returns:
- the Last Accessedcolumn
 
 - 
setDataSourceNamepublic void setDataSourceName(java.lang.String dataSourceName) Deprecated.Set the JNDI name of a DataSource-factory to use for db access- Parameters:
- dataSourceName- The JNDI name of the DataSource-factory
 
 - 
getDataSourceNamepublic java.lang.String getDataSourceName() Deprecated.- 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
 
 - 
expiredKeyspublic java.lang.String[] expiredKeys() throws java.io.IOExceptionDeprecated.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:
- java.io.IOException- if an input-/output error occurred
 
 - 
keyspublic java.lang.String[] keys() throws java.io.IOExceptionDeprecated.- 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:
- java.io.IOException- if an input/output error occurred
 
 - 
getSizepublic int getSize() throws java.io.IOExceptionDeprecated.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:
- java.io.IOException- if an input/output error occurred
 
 - 
loadpublic Session load(java.lang.String id) throws java.lang.ClassNotFoundException, java.io.IOException Deprecated.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:
- java.lang.ClassNotFoundException- if an error occurs
- java.io.IOException- if an input/output error occurred
 
 - 
removepublic void remove(java.lang.String id) throws java.io.IOExceptionDeprecated.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:
- java.io.IOException- if an input/output error occurs
 
 - 
clearpublic void clear() throws java.io.IOExceptionDeprecated.Remove all of the Sessions in this Store.- Throws:
- java.io.IOException- if an input/output error occurs
 
 - 
savepublic void save(Session session) throws java.io.IOException Deprecated.Save a session to the Store.- Parameters:
- session- the session to be stored
- Throws:
- java.io.IOException- if an input/output error occurs
 
 - 
getConnectionprotected java.sql.Connection getConnection() Deprecated.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
 
 - 
openprotected java.sql.Connection open() throws java.sql.SQLExceptionDeprecated.Open (if necessary) and return a database connection for use by this Store.- Returns:
- database connection ready to use
- Throws:
- java.sql.SQLException- if a database error occurs
 
 - 
closeprotected void close(java.sql.Connection dbConnection) Deprecated.Close the specified database connection.- Parameters:
- dbConnection- The connection to be closed
 
 - 
releaseprotected void release(java.sql.Connection conn) Deprecated.Release the connection, if it is associated with a connection pool.- Parameters:
- conn- The connection to be released
 
 - 
startInternalprotected void startInternal() throws LifecycleExceptionDeprecated.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
 
 - 
stopInternalprotected void stopInternal() throws LifecycleExceptionDeprecated.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
 
 
- 
 
-