In order to ensure the integrity of your business process data in the case of a system failure, you can configure the BPEL Service Engine to persist business process data to a database. With BPEL Persistence enabled, the BPEL Service Engine recovers otherwise lost business process data and continues processing from the point of system failure.
The BPEL Service Engine uses the JDBC resource created in the Sun Java System Application Server (GlassFish) to make the necessary database connection for persistence. NetBeans is bundled with the JavaDB database, Sun's supported distribution of the open source Apache Derby database. The BPEL Service Engine is configured to connect to the JavaDB database by default.
The BPEL Service Engine also supports connecting to an Oracle database to persist data. To create and connect to an Oracle database, see Creating a JDBC Connection Pool for Oracle and Creating a JDBC Resource for Oracle.
This section includes the following topics:
For more information on BPEL Persistence, see Using BPEL Persistence
The following procedure provides the steps for creating a JavaDB JDBC connection pool.
In your web browser, log into the Sun Java System Application Server Administrator Console. For example:
http://localhost:4848, username:admin, password: adminadmin
In the navigation tree, expand the following nodes: Resources -> JDBC.
Select Connection Pools, and in the right panel, click the New button.
Under General Settings, specify a name (such as bpelseDB).
Set the Resource Type to javax.sql.XADatasource.
Set the database vendor to Derby and click Next.
Under Connection Validation, enable Allow Non Component Callers by selecting the Enabled check box.
Under Additional Properties, specify the ServerName, User, Password and DatabaseName.
You can use the following values, or choose your own for user, password and database name (keep create=true flag).
ServerName: machine-name
DatabaseName: DatabaseName: bpelseDB;create=true
User: bpelse_user
Password: bpelse_user
Click Finish, click the connection pool name and click the Ping button.
This verifies your database connection.
Click Finish to prepare for creating a new JDBC resource.
The following procedure provides the steps for creating an Oracle JDBC connection pool. Before you create your JDBC connection for Oracle, you must create an Oracle user (with required permissions) and tablespace for BPEL Service Engine persistence.
Log into Oracle as sysdba (from SQLPlus, connect using connect sys/manager@machine-name as sysdba).
Execute the following script with default values:
Click here to download the annotated scripts.
CREATE TABLESPACE bpelsedb DATAFILE 'bpelsedb.dat' SIZE 512M REUSE AUTOEXTEND ON NEXT 2048M MAXSIZE UNLIMITED; CREATE USER bpelse_user IDENTIFIED BY bpelse_user DEFAULT TABLESPACE bpelsedb QUOTA UNLIMITED ON bpelsedb TEMPORARY TABLESPACE temp QUOTA 0M ON system; GRANT CREATE session to bpelse_user; GRANT CREATE table to bpelse_user; GRANT CREATE procedure to bpelse_user; GRANT select on sys.dba_pending_transactions to bpelse_user; GRANT select on sys.pending_trans$ to bpelse_user; GRANT select on sys.dba_2pc_pending to bpelse_user; GRANT execute on sys.dbms_system to bpelse_user; GRANT select on SYS.dba_2pc_neighbors to bpelse_user; GRANT force any transaction to bpelse_user; |
You can also connect using NetBeans IDE or a number of SQL clients by entering the username sys as sysdba. The password should be the same as that of the system user. You can also change the user, tablespace, datafile name, and size/quota according to your requirements.
In your web browser, log into the Sun Java System Application Server Administrator Console. For example:
http://localhost:4848, username:admin, password: adminadmin
Add Oracle JDBC driver classes to the application server classpath.
See the Sun Java System Application Server documentation for details on how to add the classes to the application server's classpath. One method is to navigate to Application Server > JVM Settings > Path Settings and specify the path to the jar file (including the jar file name) in the Classpath Suffix box. You must restart the application server before you continue.
In the navigation tree, expand the Resources -> JDBC nodes, and select Connection Pools.
In the right panel, click the New button.
Under General Settings, specify a name (such as bpelseDB).
Set the Resource Type to javax.sql.XADatasource.
Set the database vendor to Oracle and click Next.
Under Connection Validation, enable Allow Non Component Callers by selecting the Enabled check box.
Under Additional Properties, specify the URL, User, and Password, as follows.
You can use the following values, or choose your own for user, password and URL.
URL: jdbc:oracle:thin:@machine-name:port:sid
User: bpelse_user
Password: bpelse_use
Click Finish, click the connection pool name and click the Ping button.
This verifies your database connection.
Click Finish to prepare for creating a new JDBC resource.
The following procedure provides the steps for creating an application server database JDBC resource.
In the Sun Java System Application Server (GlassFish) navigation tree, expand the Resources -> JDBC nodes, and select JDBC Resources.
In the right panel, click the New button.
Provide a JNDIName (such as jdbc/bpelseDB) and specify the JDBC Connection Pool (bplseDB) you created previously.
You use this JNDIName when you later enable persistence in the BPEL Service Engine properties.
Expand the Configuration node and select Transaction Service.
For the On Restart parameter, enable Automatic Recovery by selecting the Enabled check box.
The following procedure provides the steps for configuring the BPEL Service Engine for persistence.
In the NetBeans IDE Services window, expand the Sun Java System Application Server (GlassFish) -> JBI -> Service Engines Nodes.
Right-click sun-bpel-engine and select Properties.
The sun-bpel-engine Properties window appears.
Set the PersistenceEnabled property value to true.
Set the JNDIName property value to specify the JNDIName of the JDBC resource that you created when you configured the database.
Click Close to save your settings.
See Configuring the BPEL Service Engine Runtime Properties for property descriptions.
Stop, shut down, and start the BPEL Service Engine to enable your new settings.
The following notes provide Drop and Truncate Scripts as well as additional information about configuring persistence. Some of the instructions mentioned here may change, so check back for updates or contact the BPEL Service Engine team if you have questions.
When the BPEL Service Engine is started, it queries the database for the existence of the tables required for persistence. If they are not there then BPEL Service Engine will create the required tables.
Drop and Truncating tables scripts for derby and oracle. Click here to download the scripts.
To drop an Oracle user, use the following script (You can download this script from here :
DROP TABLESPACE BPELSE_USER_DB INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;