I have been using JBPM5.3 for some months and then I switch to JBPM5.4.

After I download JBPM5.4.Final full installer, I thought the DB Set up will be exactly the same with JBPM5.3 full installerhttps://community.jboss.org/wiki/SetUpJBPM53ToUseMSSQLServer2008

But I realized that some things has changed and at the time when I write this, the guide for changing Database in JBPM5.4 full installer is still outdatedhttp://docs.jboss.org/jbpm/v5.4/userguide/ch.installer.html#d0e609

A. What I Am Going To Do

1. I will change the Database setting of jbpm5.4 final full installer and point it to use MS SQL Server 2008

2. The Database driver used is jtds-1.2.4

3. Although it is possible to have separate database for Task and Process data, in this setup I will use only one Database for all the Task database tables and all the Process database tables.

4. I do this set up using Windows XP 64 Bit

5. apache ant version used is Apache Ant 1.8.4

6. jdk used is jdk 1.6 (set in Windows Environment variable as JAVA_HOME)

7. I use 7-zip to help me modify files inside a .war file

B. The Setup Steps

1. JBPM5.4 final full installer comes with almost every needed component, except eclipse (optional). But I want the eclipse, so I download eclipse-java-helios-SR2-win32-x86_64.zip and put it into

jbpm-installer\lib folder

2. Because my OS is 64 bit version, I have to do a modification to the build.xml file found in jbpm-installer folder. So I changed this part

<!-- Download Eclipse -->
  <condition property="download.type" value="win32">
    <os family="windows" />
  </condition>

to

<!-- Download Eclipse -->
  <condition property="download.type" value="win32-x86_64">
    <os family="windows" />
  </condition>

3. Now its time to set up the Hibernate settings, mostly we will make changes to the hibernate dialect, lets open jbpm-installer\db folder.

4. I am not sure how each file is used here in jbpm5.4 since the official guide still reflect jbpm5.3 files, so here is what I do, I start with opening jbpm-installer\db\jbpm-persistence-JPA1.xml

I changed:

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
      <property name="hibernate.max_fetch_depth" value="3"/>

to

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
      <property name="hibernate.max_fetch_depth" value="3"/>

5. Then I open jbpm-installer\db\jbpm-persistence-JPA2.xml

I changed:

 <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
      <property name="hibernate.max_fetch_depth" value="3" />

to

 <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" />
      <property name="hibernate.max_fetch_depth" value="3" />

6. Lets continue, and open jbpm-installer\db\task-persistence-JPA1.xml

I changed:

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
      <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
      <property name="hibernate.connection.url" value="jdbc:h2:tcp://localhost/runtime/task" />
      <property name="hibernate.connection.username" value="sa"/>
      <property name="hibernate.connection.password" value=""/>

to

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
      <property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver"/>
      <property name="hibernate.connection.url" value="jdbc:jtds:sqlserver://DBName:1433/MyJBPMDB" />
      <property name="hibernate.connection.username" value="myuser"/>
      <property name="hibernate.connection.password" value="mypassword"/>

7. Open jbpm-installer\db\task-persistence-JPA2.xml

I changed:

 <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>         
      <property name="hibernate.max_fetch_depth" value="3"/>

to

 <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>         
      <property name="hibernate.max_fetch_depth" value="3"/>

8. Lets navigate to other file in other folder, lets open jbpm-installer\task-service\resources\META-INF\persistence.xml

I changed:

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
      <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
      <property name="hibernate.connection.url" value="jdbc:h2:tcp://localhost/runtime/task" />
      <property name="hibernate.connection.username" value="sa"/>
      <property name="hibernate.connection.password" value=""/>

to

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
      <property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver"/>
      <property name="hibernate.connection.url" value="jdbc:jtds:sqlserver://DBName:1433/MyJBPMDB" />
      <property name="hibernate.connection.username" value="myuser"/>
      <property name="hibernate.connection.password" value="mypassword"/>

9. Ok, lets dig into .war files in the lib folder, (I use 7-zip to help me modify files inside .war files), lets open jbpm-installer\lib folder

10. Open jbpm-installer\lib\jbpm-gwt-console-server-5.4.0.Final-EE6.war\WEB-INF\classes\META-INF\persistence.xml

I changed:

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
      <property name="hibernate.max_fetch_depth" value="3" />

to

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" />
      <property name="hibernate.max_fetch_depth" value="3" />

11. Next, Open jbpm-installer\lib\jbpm-human-task-war-5.4.0.Final-EE6.war\WEB-INF\classes\META-INF\persistence.xml

I changed:

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>         
      <property name="hibernate.max_fetch_depth" value="3"/>

to

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>         
      <property name="hibernate.max_fetch_depth" value="3"/>

12. Allright, seems like we are done changing dialects, lets provide our jtds jar. put jtds-1.2.4.jar into jbpm-installer\db\driver folder

13. next, we need to provide an xml file that will be used by jboss AS to recognize our jtds later, so Create a file called sqlserver_module.xml and put it in jbpm-installer\db folder

The file content is:

<module xmlns="urn:jboss:module:1.0" name="net.sourceforge.jtds">
   <resources>
     <resource-root path="jtds-1.2.4.jar"/>
   </resources>    <dependencies>
      <module name="javax.api"/>
      <module name="javax.transaction.api"/>
    </dependencies>
</module>

14. Wondered how the ant build will recognize our sqlserver_module.xml later? Happens to me too at first, lets open jbpm-installer\build.properties file

Look at this section:

# 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
#  db.name=mysql
#  db.driver.module.prefix=com/mysql
#  db.driver.jar.name=${db.name}-connector-java.jar
#  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
#  db.name=postresql
#  db.driver.module.prefix=org/postgresql
#  db.driver.jar.name=${db.name}-jdbc.jar
#  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

lets comment out the h2 setting and make our own sqlserver setting like this:

# 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
#  db.name=mysql
#  db.driver.module.prefix=com/mysql
#  db.driver.jar.name=${db.name}-connector-java.jar
#  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
#  db.name=postresql
#  db.driver.module.prefix=org/postgresql
#  db.driver.jar.name=${db.name}-jdbc.jar
#  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
#sqlserver
db.name=sqlserver
db.driver.module.prefix=net/sourceforge/jtds
db.driver.jar.name=jtds-1.2.4.jar

because or db.name is sqlserver, our sqlserver_module.xml will be recognized by the ant build later on.

If you really want to know the reason, open jbpm-installer\build.xml and look at this section

    <copy file="db/${db.name}_module.xml" tofile="${db.driver.module.dir}/module.xml" />

15. ok, now lets deal with the jboss AS 7 standalone setting, open jbpm-installer\standalone.xml

we need to do two things here, modify data source and make jboss as recognize our jtds driver, so change this section:

<datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="H2DS" enabled="true" use-java-context="true" use-ccm="true">
                    <connection-url>jdbc:h2:~/jbpm</connection-url>
                    <driver>h2</driver>
                    <pool>
                        <min-pool-size>1</min-pool-size>
                        <max-pool-size>4</max-pool-size>
                        <prefill>false</prefill>
                        <use-strict-min>false</use-strict-min>
                        <flush-strategy>FailingConnectionOnly</flush-strategy>
                    </pool>
                    <security>
                        <user-name>sa</user-name>
                    </security>
                    <validation>
                        <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                        <validate-on-match>false</validate-on-match>
                        <background-validation>false</background-validation>
                    </validation>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                </drivers>

to

               <datasource jndi-name="java:jboss/datasources/jbpmDS" pool-name="H2DS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                    <connection-url>jdbc:jtds:sqlserver://DBName:1433/MyJBPMDB</connection-url>
                    <driver>JTDS</driver>
                    <pool>
                        <min-pool-size>1</min-pool-size>
                        <max-pool-size>4</max-pool-size>
                        <prefill>false</prefill>
                        <use-strict-min>false</use-strict-min>
                        <flush-strategy>FailingConnectionOnly</flush-strategy>
                    </pool>
                    <security>
                       <user-name>myuser</user-name>
                       <password>mypassword</password>
                    </security>
                    <validation>
                       <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                       <validate-on-match>false</validate-on-match>
                       <background-validation>false</background-validation>
                    </validation>
                </datasource>
                <drivers>
                   <driver name="JTDS" module="net.sourceforge.jtds">
                            <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class> 
                    </driver>
                                         <driver name="h2" module="com.h2database.h2">
                                                 <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                                        </driver>
                </drivers>

16. Phew, quite a lot files that we have configured. at this point you may want to copy and backup the whole jbpm-installer folder, just in case you missed some configuration and caused error in the installation process later, who knows, things like that can happen, so just to be safe...

C. Lets Install it

1. use our windows cmd and go to jbpm-installer folder.

2. run "ant install.demo"

3. in my case, this happen, so after ant install.demo finished successfully, I need to go to

jbpm-installer\jboss-as-7.1.1.Final\standalone\deployments\jbpm-human-task-war.war\WEB-INF\classes\META-INF\persistence.xml

and modify it from

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>         
      <property name="hibernate.max_fetch_depth" value="3"/>
     <property name="hibernate.hbm2ddl.auto" value="create" />

to

<properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>         
      <property name="hibernate.max_fetch_depth" value="3"/>
      <property name="hibernate.hbm2ddl.auto" value="update" />

4. run "ant install.demo.db" to install our db files

5. run "ant start.human.task" to let it create the task tables in the database

6. stop that cmd (hint: ctrl+c and say Y)

5. run "ant start.jboss" to start the JBOSS AS server

6. Look at your database, and verify if dbo.Task table is still there.

7. Enjoy your JBPM5.4 with MS SQL Server 2008

Set up JBPM5.4 Final Installer to use MS SQL Server 2008 using JTDS(转)的更多相关文章

  1. 关于SQL Server 安装程序在运行 Windows Installer 文件时遇到错误

    前几日安装sql server2008r2 的时候碰到这个问题: 出现以下错误: SQL Server 安装程序在运行 Windows Installer 文件时遇到错误. Windows Insta ...

  2. 静默安装、授权及卸载Microsoft SQL Server、NET Framework、Windows Installer 、ArcGIS License Manager、ArcGIS Engine(Silent install、uninstall and Authorization.. .through Setup Factory)基于Setup Factory

    通过Setup Factory写的代码大概有1700行,所以就不整理了.思路如下: 静默安装都是通过去Microsoft 和Esri的官网找到静默安装的命令,然后File.Run(...)或者Shel ...

  3. (转) [it-ebooks]电子书列表

    [it-ebooks]电子书列表   [2014]: Learning Objective-C by Developing iPhone Games || Leverage Xcode and Obj ...

  4. SQL Server2016升级前几点自检

    SQL Server2016已经出来一段时间了,而且最新的SP1包也于2016年11月18日正式发布,各种新的特性推出让我们跃跃欲试.那么对于我们真实的业务环境,特别是生产环境要不要"跟风& ...

  5. Hibernate(4)——主键生成策略、CRUD 基础API区别的总结 和 注解的使用

    俗话说,自己写的代码,6个月后也是别人的代码……复习!复习!复习!涉及的知识点总结如下: hibernate的主键生成策略 UUID 配置的补充:hbm2ddl.auto属性用法 注解还是配置文件 h ...

  6. Hibernate4.2.4入门(一)——环境搭建和简单例子

    一.前言 发下牢骚,这段时间要做项目,又要学框架,搞得都没时间写笔记,但是觉得这知识学过还是要记录下.进入主题了 1.1.Hibernate简介 什么是Hibernate?Hibernate有什么用? ...

  7. Hibernate 系列 02 - Hibernate介绍及其环境搭建

    引导目录: Hibernate 系列教程 目录 昨晚喝多了,下午刚清醒,继续搞Hibernate.走起. 觉得还行的话,记得点赞哈,给我这个渣渣点学习的动力.有错误的话也请指出,省的我在错误上走了不归 ...

  8. (转)内置系统账户:Local system/Network service/Local Service 区别

    最近会转载一些 MSSQL 基础相关的文章. 参考文献: http://www.cnblogs.com/xianspace/archive/2009/04/05/1429835.html 前言 今天在 ...

  9. 小心SQL SERVER 2014新特性——基数评估引起一些性能问题

    在前阵子写的一篇博文"SQL SERVER 2014 下IF EXITS 居然引起执行计划变更的案例分享"里介绍了数据库从SQL SERVER 2005升级到 SQL SERVER ...

随机推荐

  1. mac最常用终端命令

    1分钟,快速复习下: pwd (显示当前所在路径) ls -l  (列出文件的详细信息,如创建者,创建时间,文件的读写权限列表等等) touch `filename`(创建文件) open `file ...

  2. iOS-事务相关

    事务管理 事务(Transaction):1.构成单一逻辑工作单元的操作集合DBMS中的用户程序DBMS外的可执行程序对数据库的读/写操作序列2.读从数据库中读取数据,首先从磁盘中读到内存(Buffe ...

  3. 通过 OpenNI 建立 Kinect 3D Point Cloud

    這篇還是算延續前一篇的<透過 OpneNI 合併 Kinect 深度以及彩色影像資料>.在可以透過 OpenNI 讀取到 Kinect 的深度.色彩資訊之後,其實就可以試著用這些資訊,來重 ...

  4. 【BZOJ3270】【高斯消元】博物馆

    Description 有一天Petya和他的朋友Vasya在进行他们众多旅行中的一次旅行,他们决定去参观一座城堡博物馆.这座博物馆有着特别的样式.它包含由m条走廊连接的n间房间,并且满足可以从任何一 ...

  5. 动态SQL实现批量删除指定数据库的全部进程

    动态SQL实现批量删除指定数据库的全部进程 DECLARE @DatabaseName nvarchar(100) SET @DatabaseName = N'Account_006_Kaikei_2 ...

  6. Linux网络设置高级指南

    from:http://www.oschina.net/question/23734_117144 Linux网络设置高级指南 本文面向的是被Linux复杂的有线无线网络架构弄得头昏脑胀:或者被网上半 ...

  7. C# 时间与时间戳互转

    /// <summary> /// 将c# DateTime时间格式转换为Unix时间戳格式 /// </summary> /// <param name="t ...

  8. 包管理器Bower使用手册之一

    包管理器Bower使用手册之一 作者:chszs,转载需注明.博客主页:http://blog.csdn.net/chszs 一.Bower介绍 Bower是一个适合Web应用的包管理器,它擅长前端的 ...

  9. grunt-npm编译bootstrap源码

    因为gmu需要用编译的方式下载,于是联想到bootstrap什么less sass编译 less先学,据说基于js编译和less编译器,安装起来详细, sass据网上介绍基于ruby, 以下为在mac ...

  10. yum使用详细

    1.使用YUM查找软件包 命令:yum search~ 2.列出所有可安装的软件包 命令:yum list 3.列出所有可更新的软件包 命令:yum list updates 4.列出所有已安装的软件 ...