Portlet Factory, Version 6.1.2
SQL Datasource: tracking database events
This topic describes the database-related events that the SQL Datasource builder can fire in the model.
- Release Event
- This event provides a way for a model to manipulate a connection before it is returned to the DataSource for disposal. You could use this event to perform a commit or rollback on a connection to ensure that uncommitted changes to the database are handled if your model fails to do so in other ways.
- Acquire Event
- This event provides a way for a model to manipulate a connection before it is handed off to other builders in the model. You could use this event to consistently set various parameters of a connection before it is used to access the database.
When the builder is configured to fire events it will create and register in the model an event named SqlDataSourceBuilderEvent. This name then becomes available as an option for the Event Name input of an Event Handler builder. When the builder fires this event at run-time it passes three parameters that can be used by your event handler action to manipulate the JDBC connection just acquired or about to be released. Those parameters are:
- BuilderName
- This string parameter will contain the name of the SQL DataSource builder that fired the acquire or release event. Since all DataSource builders in your model use the SqlDataSourceBuilderEvent event name, this input allows you to discriminate among all of the DataSource builders when handling events.
- eventType
- This string parameter indicates what type of event was fired. The two possible values are "Acquire" and "Release."
- connection
- This object parameter is the actual JDBC connection that was either acquired from the builder (eventType equals "Acquire") or is about to be released (eventType equals "Release") to the DataSource for disposal.
Parent topic: SQL DataSource builder
Library | Support |