简体   繁体   中英

Mule JDBC Datasource connection

I have mule 3.5 db configuration as follows

<spring:beans>
    <spring:bean id="pds" name="pds" class="com.mchange.v2.c3p0.ComboPooledDataSource" scope="singleton">
        <spring:property name="password" value="pwd"/>
        <spring:property name="jdbcUrl" value="jdbc:postgresql://localhost:5432/postgres"/>
        <spring:property name="user" value="user"/>
        <spring:property name="driverClass" value="org.postgresql.Driver"/>
    </spring:bean>
</spring:beans>
<db:generic-config name="Postgres_Datasource_Configuration"  transactionIsolation="READ_COMMITTED" doc:name="Generic Database Configuration" dataSource-ref="pds"/>

my flow looks like

<flow name="JDBC-PostgresConfigurationWithDatasource" doc:name="JDBC-OracleConfigurationWithDatasource">
    <http:inbound-endpoint exchange-pattern="request-response"  host="localhost" port="8081" doc:name="HTTP" path="postgresInboundWithDS"/>
    <logger level="INFO" doc:name="Logger"/>
    <db:select config-ref="Postgres_Datasource_Configuration" doc:name="Database">
        <db:parameterized-query><![CDATA[SELECT * FROM employee]]></db:parameterized-query>
    </db:select>
    <mulexml:object-to-xml-transformer doc:name="Object to XML"/>
    <logger level="INFO" doc:name="Logger" message="#[payload]"/>
    <logger level="INFO" doc:name="Logger"/>
</flow>

I am always getting the error saying

The attributes of Element db:generic-config{dataSource-ref=pds, name=Generic Database Configuration, name=Postgres_Datasource_Configuration, transactionIsolation=READ_COMMITTED} do not match the exclusive groups [driver, url, connectionTimeout, transactionIsolation, useXaTransactions] [dataSource-ref]

What I didn't get is I mentioned dataSource-ref, but still it is showing error as mutually exclusive.
I observed the same behavior with oracle connector also.

But I am able to connect to db when I am not using spring bean datasource.

One more weird thing is, when I was working with mule 3.4 it worked fine. Now, in 3.5 it is showing errors.


Am I missing anything?

According to the error message, if you specify dataSource-ref , then you can't specify transactionIsolation .

So remove the transactionIsolation from db:generic-config .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM