日期:2014-05-16  浏览次数:20389 次

mule3.4.0和 Jdbc 不同数据库的链接方式

derby数据库:

?<jdbc:derby-data-source name="jdbcDataSource2" url="jdbc:derby:muleEmbeddedDB"/>

db2数据库:

??? <jdbc:db2-data-source name="db2ds" url="jdbc:db2:muleDatabase" database="mule" user="admin" password="secret"/>

MSSQL数据库:

??? <!-- this data source has both url and host configured, can only be one of both -->
??? <jdbc:mssql-data-source name="mysqlDs" url="jdbc:sqlserver://localhost/mule"
???????????????????????????? host="localhost" user="scott" password="tiger"/>

MySQL数据库:

??? <!-- this data source has both url and database configured, can only be one of both -->
??? <jdbc:mysql-data-source name="mysqlDs" url="jdbc:mysql://localhost/mule" database="mule"
??????? user="mysql" password="secret"/>

    <!-- specify custom attributes of StandardDataSource -->
    <jdbc:oracle-data-source name="custom-ds-properties" user="scott" password="tiger"
        transactionIsolation="SERIALIZABLE" loginTimeout="42"/>

    <!--
        Oracle
    -->

    <!-- using the default URL -->
    <jdbc:oracle-data-source name="default-oracle" user="scott" password="tiger"/>

    <!-- using a custom URL -->
    <jdbc:oracle-data-source name="custom-url-oracle" url="jdbc:oracle:thin:@some-other-host:1522:mule"
        user="scott" password="tiger"/>

    <!-- specify custom parts of the URL -->
    <jdbc:oracle-data-source name="custom-host-oracle" host="some-other-host" user="scott" password="tiger"/>
    <jdbc:oracle-data-source name="custom-port-oracle" port="1522" user="scott" password="tiger"/>
    <jdbc:oracle-data-source name="custom-instance-oracle" instance="mule" user="scott" password="tiger"/>

    <!--
        MySQL
    -->

    <!-- using the default url -->
    <jdbc:mysql-data-source name="default-mysql" database="mule" user="mysql" password="secret"/>

    <!-- using a custom URL -->
    <jdbc:mysql-data-source name="custom-url-mysql" url="jdbc:mysql://mule-db-host:3306/mule"
        user="mysql" password="secret"/>

    <!-- custom parts of the msyql url -->
    <jdbc:mysql-data-source name="custom-host-mysql" host="some-other-host"
        database="mule" user="mysql" password="secret"/>
    <jdbc:mysql-data-source name="custom-port-mysql" port="4242"
        user="mysql" database="mule" password="secret"/>

    <!--
        PostgreSQL
    -->

    <!-- using the default url -->
    <jdbc:postgresql-data-source name="default-postgresql" database="mule"
        user="postgres" password="secret"/>

    <!-- using a custom URL -->
    <jdbc:postgresql-data-source name="custom-url-postgresql"
        url="jdbc:postgresql://mule-db-host:5432/mule" user="postgres" password="secret"/>

    <!-- custom parts of the postgresql url -->
    <jdbc:postgresql-data-source name="custom-host-postgresql" host="some-other-host"
        database="mule" user="postgres" password="secret"/>
    <jdbc:postgresql-data-source name="custom-port-postgresql" port="5433" database="mule"
        user="postgres" password="secret"/>

    <!--
        Derby
    -->

    <!-- using the default URL -->
    <jdbc:derby-data-source name="default-derby" database="mule"/>

    <!-- using a custom URL -->
    <jdbc:derby-data-source name="custom-url-derby" url="jdbc:derby:muleEmbedded"/>

    <!-- create the database -->
    <jdbc:derby-data-source name="create-database-derby" database="mule" create="true"/>

?