【Moqui框架】Moqui连接各种类型的数据库

颜高朗
2023-12-01

Moqui连接mysql数据库

 各种数据库的连接文本:

-- Derby
<datasource group-name="transactional" database-conf-name="derby" schema-name="MOQUI">
<inline-jdbc pool-minsize="5" pool-maxsize="50">
<xa-properties databaseName="${moqui.runtime}/db/derby/MoquiDEFAULT" createDatabase="create"/>
</inline-jdbc>
<!- - <inline-jdbc jdbc-uri="jdbc:derby:MoquiDEFAULT;create=true"
jdbc-username="moqui" jdbc-password="moqui" pool-minsize="5" pool-maxsize="50"/> - ->
</datasource>

-- DB2
<datasource group-name="transactional" database-conf-name="db2" schema-name="" startup-add-missing="true" runtime-add-missing="false">
<inline-jdbc pool-minsize="5" pool-maxsize="50">
<xa-properties user="moqui" password="moqui" serverName="localhost" portNumber="5021" driverType="4"
databaseName="MoquiDEFAULT"/>
</inline-jdbc>
<inline-jdbc jdbc-uri="jdbc:db2://localhost:5021/MoquiDEFAULT"
jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/> - ->
</datasource>

-- H2
<datasource group-name="transactional" database-conf-name="h2" schema-name="">
<inline-jdbc pool-minsize="5" pool-maxsize="50">
<xa-properties url="jdbc:h2:${moqui.runtime}/db/h2/MoquiDEFAULT" user="sa" password=""/>
</inline-jdbc>
<!- - <inline-jdbc jdbc-uri="jdbc:h2:${moqui.runtime}/db/h2/MoquiDEFAULT"
jdbc-username="sa" jdbc-password="" pool-minsize="5" pool-maxsize="50"/> - ->
</datasource>

-- MS SQL Server
<datasource group-name="transactional" database-conf-name="mssql" schema-name="">
<inline-jdbc pool-minsize="5" pool-maxsize="50">
<xa-properties user="moqui" password="moqui" serverName="localhost" portNumber="1433" databaseName="MoquiDEFAULT"/>
</inline-jdbc>
<!- - <inline-jdbc jdbc-uri="jdbc:sqlserver://localhost:1433;databaseName=MoquiDEFAULT"
jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/> - ->
</datasource>
-->
-- MySQL
<datasource group-name="transactional" database-conf-name="mysql" schema-name="">
<inline-jdbc pool-minsize="5" pool-maxsize="50">
<xa-properties user="moqui" password="moqui" pinGlobalTxToPhysicalConnection="true"
serverName="127.0.0.1" port="3306" databaseName="MoquiDEFAULT" autoReconnectForPools="true"
useUnicode="true" encoding="UTF-8"/>
</inline-jdbc>
<!- - <inline-jdbc jdbc-uri="jdbc:mysql://127.0.0.1:3306/MoquiDEFAULT?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8"
jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/> - ->
</datasource>

-- Oracle
<datasource group-name="transactional" database-conf-name="oracle" schema-name="MOQUI">
<inline-jdbc pool-minsize="5" pool-maxsize="50">
<xa-properties user="moqui" password="moqui" URL="jdbc:oracle:thin:@127.0.0.1:1521:MoquiDEFAULT"/>
</inline-jdbc>
<!- - <inline-jdbc jdbc-uri="jdbc:oracle:thin:@127.0.0.1:1521:MoquiDEFAULT"
jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/> - ->
</datasource>

-- PostgreSQL
<datasource group-name="transactional" database-conf-name="postgres" schema-name="public" startup-add-missing="true" runtime-add-missing="false">
<inline-jdbc pool-minsize="5" pool-maxsize="50">
<xa-properties user="moqui" password="moqui" serverName="localhost" portNumber="5432"
databaseName="MoquiDEFAULT"/>
</inline-jdbc>
<!- - <inline-jdbc jdbc-uri="jdbc:postgresql://127.0.0.1/MoquiDEFAULT"
jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/> - ->
</datasource>

1.修改moqui\runtime\conf\MoquiProductionConf.xml根据需要加入对应的文本:
<entity-facade crypt-pass="MoquiProductionDefaultPassword:CHANGEME">
        <datasource group-name="transactional" database-conf-name="mysql" check-pks-on-start="true" schema-name="">
            <inline-jdbc jdbc-uri="jdbc:mysql://127.0.0.1:3306/moquitransactional?autoReconnect=true&amp;characterEncoding=UTF-8"
                jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2"
                pool-maxsize="50" />
        </datasource>
 </entity-facade>
 2.用java  -Dmoqui.conf=conf/MoquiProductionConf.xml -jar moqui-1.0.2.war -load  加载数据。
 
 
3.java  -Dmoqui.conf=conf/MoquiProductionConf.xml -jar moqui-1.0.2.war 启动服务

转载于:https://www.cnblogs.com/dream-to-pku/p/5477497.html

 类似资料: