Mule ESB简单jdbc插入



我试图强制Mule ESB Studio在jdbc中执行一些简单的插入。我的目标是在我的Web浏览器中打开一个页面,假设它是http://localhost:8081/,然后Mule ESB执行将"foobar"值插入数据库。

这是我的代码:

<jdbc-ee:mssql-data-source name="MS_SQL_Data_Source" user="esbtest" password="Test123" transactionIsolation="NONE" doc:name="MS SQL Data Source"  loginTimeout="10000" 
url="jdbc:sqlserver://10.1.212.42:1433;databaseName=test"></jdbc-ee:mssql-data-source>
<jdbc-ee:connector name="Database" dataSource-ref="MS_SQL_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"/>
<flow name="Test_PierwszyFlow1" doc:name="Test_PierwszyFlow1"> 
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP" mimeType="text/plain"></http:inbound-endpoint>
    <object-to-string-transformer doc:name="Object to String"/>
    <jdbc-ee:outbound-endpoint exchange-pattern="one-way"  queryTimeout="-1" doc:name="Database" connector-ref="Database" queryKey="insertQuery">
        <jdbc-ee:query key="insertQuery" value="INSERT INTO t_Login (login) VALUES ('foo bar')"/>
    </jdbc-ee:outbound-endpoint>
</flow>

我没有具体说明任何豆子或诸如此类的东西。在日志中,我看到以下行:

    INFO  2013-07-02 11:20:37,550 [[test_pierwszy].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'Database.dispatcher.1938839184'. Object is: EEJdbcMessageDispatcher
INFO  2013-07-02 11:20:37,550 [[test_pierwszy].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'Database.dispatcher.1938839184'. Object is: EEJdbcMessageDispatcher
INFO  2013-07-02 11:20:37,670 [[test_pierwszy].connector.http.mule.default.receiver.02] com.mulesoft.mule.transport.jdbc.sqlstrategy.UpdateSqlStatementStrategy: Executing SQL statement: 1 row(s) updated
INFO  2013-07-02 11:20:37,730 [[test_pierwszy].connector.http.mule.default.receiver.02] com.mulesoft.mule.transport.jdbc.sqlstrategy.UpdateSqlStatementStrategy: Executing SQL statement: 1 row(s) updated

但是我的数据库是空的!我必须说,我是Mule ESB领域的新手,不知道哪里出了问题。请帮忙。

编辑:有趣的是,当我将talbe或列名更改为某个不存在的东西时,我会得到相应的JDBC错误。

第二个问题是,如何注入到我在URL中指定的DB值?例如,当我在浏览器http://localhost:8081/foo中键入时,值foo被传递到jdbc结果连接器,并插入"foo"值。

提前谢谢。

我猜这里是未提交的事务。尝试将transactionPerMessage="true"添加到<jdbc-ee:connector...

我在Mule EE中注意到了类似的问题,Mule CE运行良好。。。

当您使用ArrayList负载调用jdbc:outbound端点,但在SQL查询中使用SESSION/INVOCATION变量作为参数时,我注意到它对所讨论的表没有影响(没有Insert/Update),但记录器记录"Record Updated"。将这个jdbc调用的有效负载更改为其他类型的Object解决了这个问题。要保持开放心态,请考虑:-而是通过Payload传递SQL查询参数-考虑消息富集器

最新更新