金仓数据库KingbaseES客户端编程开发框架-Activiti(3. Activiti环境配置说明)

3. Activiti环境配置说明

本部分介绍了使用Activiti时需要的环境配置操作。

本部分包含以下章节:

3.1. 数据库连接配置

Activiti的配置信息可以通过配置文件配置,也可以直接在代码中进行配置,以下是两种方式的举例。

  1. Activiti使用配置文件配置连接信息,创建工作流需要的表。

    在activiti.cfg.xml 中增加如下声明:

    (KES形态)

    <bean id="processEngineConfiguration"
            class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
            <property name="jdbcDriver" value="com.kingbase8.Driver"></property>
            <property name="jdbcUrl" value="jdbc:kingbase8://localhost:54321/test"
                ></property>
            <property name="jdbcUsername" value="test"></property>
            <property name="jdbcPassword" value="test"></property>
            <property name="databaseType" value="postgres"></property>
            <!-- 没有表创建表 -->
            <property name="databaseSchemaUpdate" value="true"></property>
        </bean>
    

    (PG形态)

    <bean id="processEngineConfiguration"
            class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
            <property name="jdbcDriver" value="org.postgresql.Driver"></property>
            <property name="jdbcUrl" value="jdbc:postgresql://localhost:54321/test"
                ></property>
            <property name="jdbcUsername" value="test"></property>
            <property name="jdbcPassword" value="test"></property>
            <property name="databaseType" value="postgres"></property>
            <!-- 没有表创建表 -->
            <property name="databaseSchemaUpdate" value="true"></property>
        </bean>
    

    配置时根据实际情况修改 "jdbcDriver" 、"jdbcUrl" 、"databaseType"即可。

  2. Activiti使用代码配置连接信息,创建工作流需要的表。

    @Test
    public void createTable(){
        ProcessEngineConfiguration processEngineConfiguration =
            ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
        processEngineConfiguration.setJdbcDriver("org.postgresql.Driver");
        processEngineConfiguration.setJdbcUrl(
            "jdbc:postgresql://localhost:54321/test");
        processEngineConfiguration.setJdbcUsername("test");
        processEngineConfiguration.setJdbcPassword("test");
        processEngineConfiguration.setDatabaseType("postgres");
    
        processEngineConfiguration.setDatabaseSchemaUpdate(
            ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
        ProcessEngine processEngine =
            processEngineConfiguration.buildProcessEngine();
    }
    

    配置时根据实际情况修改以下参数:

    1. processEngineConfiguration.setJdbcDriver

    2. processEngineConfiguration.setJdbcUrl

    3. processEngineConfiguration.setDatabaseType

3.2. 建表文件

KingbaseES兼容Activiti的核心,使用的是PG的建表语句。详细请参考:Getting Started with Activiti Core Runtime APIs 。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值