jbpm6.5 環境搭建(三) 數據庫 切換

通過一夜的折騰,終於搞定,成功切換Mysqljava

步驟一:

安裝mysql  數據庫   建立數據庫 名字爲jbpm  設置用戶名密碼  我本地默認使用 root

步驟二:

** 修改配置文件 **mysql

F:\jbpm-6.5.0.Final-installer-full\jbpm-installer下 standalone-full-wildfly-10.0.0.Final.xml 和 standalone-wildfly-10.0.0.Final.xmlsql

因爲根據官網 我本地下載的jboss服務器是 widfly10 因此 只須要修改上面的配置文件就能夠了,而後 當用ant命令時,ant會自動把這2個文件的內容複製到 F:\jbpm-6.5.0.Final-installer-full\jbpm-installer\wildfly-10.0.0.Final\standalone\configuration 中數據庫

兩個文件做一樣的修改。服務器

修改前maven

<datasources>
              <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                  <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                  <driver>h2</driver>
                  <security>
                      <user-name>sa</user-name>
                      <password>sa</password>
                  </security>
              </datasource>
              <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:tcp://localhost/~/jbpm-db;MVCC=TRUE</connection-url>
                  <driver>h2</driver>
                  <security>
                      <user-name>sa</user-name>
                  </security>
              </datasource>
              <drivers>
                  <driver name="h2" module="com.h2database.h2">
                      <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                  </driver>
              </drivers>
          </datasources>

修改後tcp

<datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                <connection-url>jdbc:mysql://localhost:3306/jbpm</connection-url>
    <driver>mysql</driver>
    <security>
       <user-name>root</user-name>
       <password>root</password>
    </security>
                </datasource>
                <datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="MySQLDS"               enabled="true" use-java-context="true" use-ccm="true">
    <connection-url>jdbc:mysql://localhost:3306/jbpm</connection-url>
    <driver>mysql</driver>
    <security>
       <user-name>root</user-name>
       <password>root</password>
    </security>
</datasource>
                <drivers>
                   <driver name="mysql" module="com.mysql">
                     <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
       </driver>
                </drivers>
            </datasources>

步驟三:

修改配置文件ide

F:\jbpm-6.5.0.Final-installer-full\jbpm-installer\db 下 的 jbpm-persistence-JPA2.xml 和 mysql_module.xmlui

jbpm-persistence-JPA2.xml 中this

修改前

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

修改後

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>

mysql_module.xml 中

**修改前 **

<resource-root path="mysql-connector-java.jar"/>

修改後

官網:this file is called db/mysql_module.xml. Open this file and make sure that the file name of the driver jar listed there is identical the driver jar name you specified in the build.properties (including the version). Note that, even if you simply uncommented the default MySQL configuration, you will still need to add the right version here.

<resource-root path="mysql-connector-java-5.1.18.jar"/>

步驟四:

修改配置文件 build.properties

F:\jbpm-6.5.0.Final-installer-full\jbpm-installer 下

修改前

# default is H2
H2.version=1.3.168
db.name=h2
db.driver.jar.name=h2-${H2.version}.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=mysql-connector-java-5.1.18.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

修改後

# default is H2
 #H2.version=1.3.168
 #db.name=h2
 #db.driver.jar.name=h2-${H2.version}.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=mysql-connector-java-5.1.18.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

到此 修改工做結束,接着就是 嘗試 ant 命令

輸入圖片說明

如圖: 輸入圖片說明

說明 部署成功

到此 修改 數據庫 有H2 轉成 mysql 成功

歡迎 各位大佬 光臨指正 有問題 在線留言

相關文章
相關標籤/搜索