public abstract class JDBCAction extends AbstractAction implements IfsParameters
Modifier and Type | Field and Description |
---|---|
static String |
NOLOG
Option key "nolog" when "true" means not to establish a connection.
|
CONTINUE_ON_ERROR, m_defaultOptions, m_options
APPEND_LOG, DATABASE_TYPE, DATABASE_URL, DB_USER_NAME, DB_USER_PASSWORD, DOMAIN_TYPE, ENABLE_SSL_SUPPORT, FOR_SCHEMA_UPGRADE, IFS_DOMAIN_DISPLAY_NAME, IFS_DOMAIN_NAME, IFS_SCHEMA_NAME, IFS_SCHEMA_PASSWORD, IFS_SERVICE_NAME, IFS_USER_NAME, IFS_USER_PASSWORD, INCLUDE_PATH, INITIAL_CONTEXT_FACTORY, LDAP_URL_DAS_LOOKUP, LDAP_USER_NAME, LDAP_USER_PASSWORD, OUTPUT_FILE, PARAMETER_FILE, REGISTRY, SCHEMA_VERSION_KEY, SECURITY_PROTOCOL_NAME, SERVICE_CONFIGURATION_NAME
Constructor and Description |
---|
JDBCAction()
Creates a new JDBCAction without specifying database credentials.
|
JDBCAction(String user,
String password,
String url)
Creates a new JDBCAction.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
execute(Connection con)
Executes JDBC statements.
|
void |
perform()
Performs this JDBCAction.
|
void |
setDatabaseUrl(String url)
Sets the database URL to use when connecting.
|
void |
setPassword(String password)
Sets the database user password.
|
void |
setUser(String user)
Sets the the database user (schema) name to connect as.
|
getDescription, getName, getValue, isContinueOnError, isPostgres, putValue, setDefaultOptions, setDescription, setName, setOptions
public static final String NOLOG
public JDBCAction()
public void setUser(String user)
user
- the database user (schema) name to connect as.public void setPassword(String password)
password
- the database user's password.public void setDatabaseUrl(String url)
url
- the database URL to use when connecting.public void perform() throws ActionFailedException
Opens a JDBC Connection to the specified database, invokes the execute method, passing it the Connection, and closes the Connection when the execute method returns.
perform
in interface Action
ActionFailedException
- if this Action fails.public abstract void execute(Connection con) throws SQLException, ActionFailedException
Note: Subclasses should provide an implementation for this method.
The Connection does not need to be closed by this method; the calling method will close it. However, any Statement or ResultSet objects that are opened should be closed explicitly.
con
- the Connection to the database.SQLException
- if a database error occurs.ActionFailedException
- if any other error occurs.Copyright © 2023. All rights reserved.