<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Set up jBPM5.4 Final Installer to use MySQL - or how to run section 3.7 of the User Guide
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/iahi1998">iahi1998</a> in <i>jBPM</i> - <a href="https://community.jboss.org/docs/DOC-48374">View the full document</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I've started using jBPM 5.4 a couple weeks ago. It's my first forray into jBPM and I am slowly working through the user guide. I go to <a class="jive-link-external-small" href="http://docs.jboss.org/jbpm/v5.4/userguide/ch.installer.html#d0e609">3.7. 10-Minute Tutorial: Using your own database with jBPM</a> and got stuck.</p><p>First of all, credits. <span style="font-size: 10pt;">I thank </span><a class="jive-link-profile-small" href="https://community.jboss.org/people/thomas.setiabudi">Thomas Setiabudi</a><span style="font-size: 10pt;"> for posting the wonderful article titled </span><a class="" href="https://community.jboss.org/docs/DOC-47975">Set up JBPM5.4 Final Installer to use MS SQL Server 2008 using JTDS</a> which I used for inspiration.</p><p>Second, shameless plug - <a class="jive-link-external-small" href="https://sites.google.com/site/insearchofbpm/home/jbpm/on-ubuntu-desktop-12-04" rel="nofollow">my forray into jBPM</a> which I will update as I make my way through the user guide.</p><p>And, last, but not least, the information,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My OS Ubuntu Desktop 12.04. If you are using Windows, be aware that you will have to rewrite paths with the backslashes "\" appropriate for your system..</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The article is split into four steps:</p><ul><li>Set up MySQL</li><li>Set up jBPM</li><li>Install jBPM</li><li>Run the demo using your own Database</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h1>Set up MySQL</h1><p>With MySQL installed, log in as the root user and run the following commands from the mysql&gt; <span style="font-size: 10pt;">prompt:</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">mysql&gt; CREATE SCHEMA IF NOT EXISTS jbpm5;
mysql&gt; CREATE USER 'jbmp5'@'localhost' IDENTIFIED BY 'jbpm5';
mysql&gt; GRANT ALL PRIVILEGES ON jbpm5.* TO 'jbpm5'@'localhost';
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">mysql&gt; CREATE SCHEMA IF NOT EXISTS task;
mysql&gt; CREATE USER 'task'@'localhost' IDENTIFIED BY 'task';
mysql&gt; GRANT ALL PRIVILEGES ON task.* TO 'task'@'localhost;
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h1>Set up jBPM</h1><p>First, run </p><pre class="jive-pre"><code class="jive-code">ant clean.demo
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Second, you will have to change the following files:</p><ul><li>build.properties</li><li>build.xml</li><li>db/jbpm-persistence-JPA2.xml</li><li>db/task-persistence-JPA2.xml</li><li>standalone.xml</li><li>task-service/resources/META-INF/persistence.xml</li><li>lib/jbpm-gwt-console-server-5.4.0.Final-EE6.war/WEB-INF/classes/META-INF/persistence.xml</li><li>lib/jbpm-human-task-war-5.4.0.Final-EE6.war/WEB-INF/classes/META-INF/persistence.xml</li></ul><h2>build.properties<span style="font-size: 10pt;"> </span></h2><p>Change</p><pre class="jive-pre"><code class="jive-code"># data base related properties
db.driver.jar=${install.home}/db/driver/${db.driver.jar.name}
db.driver.module.dir=${jboss.home}/modules/${db.driver.module.prefix}/main/
# default is H2
db.name=h2
db.driver.jar.name=${db.name}.jar
db.driver.download.url=http://repo1.maven.org/maven2/com/h2database/h2/${H2.version}/h2-${H2.version}.jar
#other options are mysql
#&#160; db.name=mysql
#&#160; db.driver.module.prefix=com/mysql
#&#160; db.driver.jar.name=${db.name}-connector-java.jar
#&#160; db.driver.download.url=https://repository.jboss.org/nexus/service/local/repositories/central/content/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar
#postresql
#&#160; db.name=postresql
#&#160; db.driver.module.prefix=org/postgresql
#&#160; db.driver.jar.name=${db.name}-jdbc.jar
#&#160; db.driver.download.url=https://repository.jboss.org/nexus/content/repositories/thirdparty-uploads/postgresql/postgresql/9.1-902.jdbc4/postgresql-9.1-902.jdbc4.jar
</code></pre><p>To</p><pre class="jive-pre"><code class="jive-code"># data base related properties
db.driver.jar=${install.home}/db/driver/${db.driver.jar.name}
db.driver.module.dir=${jboss.home}/modules/${db.driver.module.prefix}/main/
#&#160; default is H2
#&#160; db.name=h2
#&#160; db.driver.jar.name=${db.name}.jar
#&#160; db.driver.download.url=http://repo1.maven.org/maven2/com/h2database/h2/${H2.version}/h2-${H2.version}.jar
#other options are mysql
&#160; db.name=mysql
&#160; db.driver.module.prefix=com/mysql
&#160; db.driver.jar.name=${db.name}-connector-java.jar
&#160; db.driver.download.url=https://repository.jboss.org/nexus/service/local/repositories/central/content/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar
#postresql
#&#160; db.name=postresql
#&#160; db.driver.module.prefix=org/postgresql
#&#160; db.driver.jar.name=${db.name}-jdbc.jar
#&#160; db.driver.download.url=https://repository.jboss.org/nexus/content/repositories/thirdparty-uploads/postgresql/postgresql/9.1-902.jdbc4/postgresql-9.1-902.jdbc4.jar
</code></pre><h2>build.xml</h2><p><span style="font-size: 10pt;">In</span></p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-comment">&lt;!-- Start Demo --&gt;
<span class="jive-xml-tag">&lt;target name="start.demo" depends="start.h2,start.jboss,start.eclipse" /&gt;</span>


&lt;!-- Start Demo (Eclipse) --&gt;
<span class="jive-xml-tag">&lt;target name="start.demo.eclipse" depends="start.h2,start.eclipse" /&gt;</span>


&lt;!-- Start Demo (No Eclipse)--&gt;
<span class="jive-xml-tag">&lt;target name="start.demo.noeclipse" depends="start.h2,start.jboss" /&gt;</span>


&lt;!-- Stop Demo --&gt;</span>
<span class="jive-xml-tag">&lt;target name="stop.demo" depends="stop.h2,stop.jboss" /&gt;</span>
</code></pre><p>Add</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-comment">&lt;!-- Start Demo --&gt;
<span class="jive-xml-tag">&lt;target name="start.demo" depends="start.h2,start.jboss,start.eclipse" /&gt;</span>


&lt;!-- Start Demo (DB) --&gt;
<span class="jive-xml-tag">&lt;target name="start.demo.db" depends="start.jboss, start.eclipse" /&gt;</span>


&lt;!-- Start Demo (DB, No Eclipse) --&gt;
<span class="jive-xml-tag">&lt;target name="start.demo.db.noeclipse" depends="start.jboss" /&gt;</span>


&lt;!-- Start Demo (Eclipse) --&gt;
<span class="jive-xml-tag">&lt;target name="start.demo.eclipse" depends="start.h2,start.eclipse" /&gt;</span>


&lt;!-- Start Demo (No Eclipse)--&gt;
<span class="jive-xml-tag">&lt;target name="start.demo.noeclipse" depends="start.h2,start.jboss" /&gt;</span>


&lt;!-- Stop Demo --&gt;
<span class="jive-xml-tag">&lt;target name="stop.demo" depends="stop.h2,stop.jboss" /&gt;</span>


&lt;!-- Stop Demo (DB)--&gt;</span>
<span class="jive-xml-tag">&lt;target name="stop.demo.db" depends="stop.jboss" /&gt;</span>
</code></pre><h2>db/jbpm-persistence-JPA2.xml</h2><p><span style="font-size: 10pt;">Change</span></p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /&gt;</span>
</code></pre><p>To</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /&gt;</span>
</code></pre><h2>db/task-persistence-JPA2.xml</h2><p><span style="font-size: 10pt;">Change</span></p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/&gt;</span>
</code></pre><p>To</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/&gt;</span>
</code></pre><h2>standalone.xml</h2><p><span style="font-size: 10pt;">Change</span></p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="H2DS" enabled="true" use-java-context="true" use-ccm="true"&gt;</span>
&#160; <span class="jive-xml-tag">&lt;connection-url&gt;</span>jdbc:h2:~/jbpm<span class="jive-xml-tag">&lt;/connection-url&gt;</span>
&#160; <span class="jive-xml-tag">&lt;driver&gt;</span>h2<span class="jive-xml-tag">&lt;/driver&gt;</span>
&#160; <span class="jive-xml-tag">&lt;pool&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;min-pool-size&gt;</span>1<span class="jive-xml-tag">&lt;/min-pool-size&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;max-pool-size&gt;</span>4<span class="jive-xml-tag">&lt;/max-pool-size&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;prefill&gt;</span>false<span class="jive-xml-tag">&lt;/prefill&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;use-strict-min&gt;</span>false<span class="jive-xml-tag">&lt;/use-strict-min&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;flush-strategy&gt;</span>FailingConnectionOnly<span class="jive-xml-tag">&lt;/flush-strategy&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/pool&gt;</span>
&#160; <span class="jive-xml-tag">&lt;security&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;user-name&gt;</span>sa<span class="jive-xml-tag">&lt;/user-name&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/security&gt;</span>
&#160; <span class="jive-xml-tag">&lt;validation&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;check-valid-connection-sql&gt;</span>SELECT 1<span class="jive-xml-tag">&lt;/check-valid-connection-sql&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;validate-on-match&gt;</span>false<span class="jive-xml-tag">&lt;/validate-on-match&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;background-validation&gt;</span>false<span class="jive-xml-tag">&lt;/background-validation&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/validation&gt;</span>
<span class="jive-xml-tag">&lt;/datasource&gt;</span>
<span class="jive-xml-tag">&lt;drivers&gt;</span>
&#160; <span class="jive-xml-tag">&lt;driver name="h2" module="com.h2database.h2"&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;xa-datasource-class&gt;</span>org.h2.jdbcx.JdbcDataSource<span class="jive-xml-tag">&lt;/xa-datasource-class&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/driver&gt;</span>
<span class="jive-xml-tag">&lt;/drivers&gt;</span>
</code></pre><p><span style="font-family: 'courier new', courier;">To</span></p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="H2DS" enabled="true" use-java-context="true" use-ccm="true"&gt;</span>
&#160; <span class="jive-xml-tag">&lt;connection-url&gt;</span>jdbc:mysql://localhost:3306/jbpm5<span class="jive-xml-tag">&lt;/connection-url&gt;</span>
&#160; <span class="jive-xml-tag">&lt;driver&gt;</span>mysql<span class="jive-xml-tag">&lt;/driver&gt;</span>
&#160; <span class="jive-xml-tag">&lt;pool&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;min-pool-size&gt;</span>1<span class="jive-xml-tag">&lt;/min-pool-size&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;max-pool-size&gt;</span>4<span class="jive-xml-tag">&lt;/max-pool-size&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;prefill&gt;</span>false<span class="jive-xml-tag">&lt;/prefill&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;use-strict-min&gt;</span>false<span class="jive-xml-tag">&lt;/use-strict-min&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;flush-strategy&gt;</span>FailingConnectionOnly<span class="jive-xml-tag">&lt;/flush-strategy&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/pool&gt;</span>
&#160; <span class="jive-xml-tag">&lt;security&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;user-name&gt;</span>jbpm5<span class="jive-xml-tag">&lt;/user-name&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;password&gt;</span>jbpm5<span class="jive-xml-tag">&lt;/password&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/security&gt;</span>
&#160; <span class="jive-xml-tag">&lt;validation&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;check-valid-connection-sql&gt;</span>SELECT 1<span class="jive-xml-tag">&lt;/check-valid-connection-sql&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;validate-on-match&gt;</span>false<span class="jive-xml-tag">&lt;/validate-on-match&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;background-validation&gt;</span>false<span class="jive-xml-tag">&lt;/background-validation&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/validation&gt;</span>
<span class="jive-xml-tag">&lt;/datasource&gt;</span>
<span class="jive-xml-tag">&lt;drivers&gt;</span>
&#160; <span class="jive-xml-tag">&lt;driver name="mysql" module="com.mysql"&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;xa-datasource-class&gt;</span>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource<span class="jive-xml-tag">&lt;/xa-datasource-class&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/driver&gt;</span>
<span class="jive-xml-tag">&lt;/drivers&gt;</span>
</code></pre><h2>task-service/resources/META-INF/persistence.xml</h2><p><span style="font-size: 10pt;">Change</span></p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/&gt;</span>
<span class="jive-xml-tag">&lt;property name="hibernate.connection.driver_class" value="org.h2.Driver"/&gt;</span>
<span class="jive-xml-tag">&lt;property name="hibernate.connection.url" value="jdbc:h2:tcp://localhost/runtime/task" /&gt;</span>
<span class="jive-xml-tag">&lt;property name="hibernate.connection.username" value="sa"/&gt;</span>
<span class="jive-xml-tag">&lt;property name="hibernate.connection.password" value=""/&gt;</span>
</code></pre><p>To</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/&gt;</span>
<span class="jive-xml-tag">&lt;property name="hibernate.connection.driver_class" value="org.jdbc.Driver"/&gt;</span>
<span class="jive-xml-tag">&lt;property name="hibernate.connection.url" value="jdbc:mysql:://localhost:3306/task" /&gt;</span>
<span class="jive-xml-tag">&lt;property name="hibernate.connection.username" value="task"/&gt;</span>
<span class="jive-xml-tag">&lt;property name="hibernate.connection.password" value="task"/&gt;</span>
</code></pre><h2>lib/jbpm-gwt-console-server-5.4.0.Final-EE6.war/WEB-INF/classes/META-INF/persistence.xml</h2><p><span style="font-size: 10pt;">To edit this file, take advantage of the GUI. Navigate to the .war file using Nautilus and rely on File Roller to open the .war file. File Roller should come pre-installed on Ubuntu Desktop 12.04. Once you're inside the .war file, you can use gedit to open persistence.xml. When you save, File Roller will ask if you want to update the&#160; archive and you must. On Window, 7-Zip can be used to open the .war file.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-size: 10pt;">Change</span></p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" /&gt;</span>
</code></pre><p>To</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /&gt;</span>
</code></pre><h2>lib/jbpm-human-task-war-5.4.0.Final-EE6.war/WEB-INF/classes/META-INF/persistence.xml</h2><p><span style="font-size: 10pt;">To edit this file, take advantage of the GUI. Navigate to the .war file using Nautilus and rely on File Roller to open the .war file. File Roller should come pre-installed on Ubuntu Desktop 12.04. Once you're inside the .war file, you can use gedit to open persistence.xml. When you save, File Roller will ask if you want to update the&#160; archive and you must. On Window, 7-Zip can be used to open the .war file.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Change</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" /&gt;</span>
</code></pre><p>To</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /&gt;</span>
</code></pre><h1>Install jBPM</h1><p><span style="font-size: 10pt;">Run </span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">ant install.demo </code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-size: 10pt;">This will install the jBPM demo and pull all the appropriate drivers and files for MySQL.</span></p><h1>Run the demo using your own Database</h1><p><span style="font-size: 10pt;">To start the demo you can run</span></p><pre class="jive-pre"><code class="jive-code">ant start.demo.db
</code></pre><p>or</p><pre class="jive-pre"><code class="jive-code">ant start.demo.db.noeclipse
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>To stop the demo, run</p><pre class="jive-pre"><code class="jive-code">ant stop.demo.db
</code></pre></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Comment by <a href="https://community.jboss.org/docs/DOC-48374">going to Community</a></p>

        <p style="margin: 0;">Create a new document in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>