<module xmlns="urn:jboss:module:1.1" name="mysql"> <resources> <resource-root path="mysql-connector-java-5.1.12.jar"/> </resources> <dependencies> <module name="javax.api"/> <module name="javax.transaction.api"/> </dependencies> </module>
In BPEL component, we are using the in-memory H2 database, this page is trying to give you an example that update it to a Mysql database.
Download the db ANT script zip from here, we use the RiftSaw-3.0.0 Final release (used in SwitchYard 1.0.0.Final) as an example.
create the folder in $SwitchYard/modules/mysql/main, and then copy the mysql-connector-java-5.1.12.jar (of course, you can choose other versions, but in this page, we are using this version as an example) inside it.
create a module.xml along with it, the content is like following:
<module xmlns="urn:jboss:module:1.1" name="mysql"> <resources> <resource-root path="mysql-connector-java-5.1.12.jar"/> </resources> <dependencies> <module name="javax.api"/> <module name="javax.transaction.api"/> </dependencies> </module>
add the mysql driver and the datasource in standalone.xml file.
<subsystem xmlns="urn:jboss:domain:datasources:1.0"> <datasources> ..... <datasource jndi-name="java:jboss/datasources/BpelDS" enabled="true" use-java-context="true" pool-name="BpelDS"> <connection-url>jdbc:mysql://localhost:3306/riftsaw</connection-url> <driver>mysql</driver> <pool/> <security> <user-name>root</user-name> <password>jeff</password> </security> </datasource> <drivers> ... <driver name="mysql" module="mysql"> <driver-class>com.mysql.jdbc.Driver</driver-class> </driver> </drivers> </datasources> </subsystem>
Go to the folder that you have extracted for db script zip that we downloaded earlier, let us call it '$dbscript'.
update the jdbc properties properly in $dbscript/jdbc/mysql.properties. (for other databases, update other $database.properties file)
update the build.xml file's database property as your target db, (mysql in this case)
run following command to populate the schema:
ant create.riftsaw.schema
you should be able to view the tables via: ant db.show.tables command, and drop the database script through: ant drop.riftsaw.schema
Go to the $SwitchYard/standalone/configuration/standalone.xml, find the BPELComponent, and then overriding following properties:
<module identifier="org.switchyard.component.bpel" implClass="org.switchyard.component.bpel.deploy.BPELComponent"> <properties> <bpel.db.mode>EXTERNAL</bpel.db.mode> <db.emb.create>false</db.emb.create> <bpel.db.ext.dataSource>java:jboss/datasources/BpelDS</bpel.db.ext.dataSource> <hibernate.dialect>org.hibernate.dialect.MySQLInnoDBDialect</hibernate.dialect> </properties> </module>
Then you should be ready to start the SwitchYard, the BPEL component will use the database that you created.