Mule MySQL连接器
我正在尝试使用本教程将Mule连接到MySQL数据库(在Mule中非常新): 我一直往下走到步骤6(测试列表项)。如果转到指定的URL,则会出现以下错误:Mule MySQL连接器,mysql,mule,Mysql,Mule,我正在尝试使用本教程将Mule连接到MySQL数据库(在Mule中非常新): 我一直往下走到步骤6(测试列表项)。如果转到指定的URL,则会出现以下错误: Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=jdbc://selectAll, connector=EEJdbcConnector { name=Database lifecycle=start this=5b3808ad n
Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=jdbc://selectAll, connector=EEJdbcConnector
{
name=Database
lifecycle=start
this=5b3808ad
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=false
connected=true
supportedProtocols=[jdbc]
serviceOverrides=<none>
}
, name='endpoint.jdbc.selectAll', mep=REQUEST_RESPONSE, properties={queryTimeout=-1}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: String
未能通过端点路由事件:DefaultOutboundEndpoint{endpointUri=jdbc://selectAll,connector=EEJdbcConnector
{
名称=数据库
生命周期=开始
这个=5b3808ad
ConcurrentTransacticedReceiver的数量=4
CreateMultipleTransactedReceiver=false
已连接=真
supportedProtocols=[jdbc]
服务覆盖=
}
,name='endpoint.jdbc.selectAll',mep=REQUEST\u RESPONSE,properties={queryTimeout=-1},transactionConfig=Transaction{factory=null,action=interference,timeout=0},deleteUnceptedMessages=false,initialState=started,responseTimeout=10000,endpointEncoding=UTF-8,disableTransportTransformer=false}。消息负载的类型为:String
我已经找了很长时间了,但我找不到解决办法。
也许你们能帮我一下
这是我的XML:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd">
<jdbc-ee:mysql-data-source name="MySQL_Data_Source" user="$(db.user)" password="$(db.password)" url="$(db.connection_string)" transactionIsolation="UNSPECIFIED" doc:name="MySQL Data Source"/>
<jdbc-ee:connector name="Database" dataSource-ref="MySQL_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database">
<jdbc-ee:query key="selectAll" value="SELECT * FROM demo_tbl"/>
<jdbc-ee:query key="insertItem" value="INSERT INTO demo_tbl SET title=#[message.inboundProperties['title']], description=#[message.inboundProperties['description']]"/>
<jdbc-ee:query key="deleteItem" value="DELETE FROM demo_tbl WHERE id=#[message.inboundProperties['id']]"/>
<jdbc-ee:query key="findById" value="SELECT * FROM demo_tbl WHERE id=#[message.inboundProperties['id']]"/>
<jdbc-ee:query key="updateItem" value="UPDATE demo_tbl SET title=#[message.inboundProperties['title']], description=#[message.inboundProperties['description']] WHERE id=#[message.inboundProperties['id']]"/>
</jdbc-ee:connector>
<flow name="jdbc_demoFlow1" doc:name="jdbc_demoFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="list" doc:name="HTTP"/>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="selectAll" queryTimeout="-1" connector-ref="Database" doc:name="Database"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
</mule>
尝试了最新的MySQL连接器(MySQL-Connector-java-5.1.29-bin),以及教程中提到的1。两个都不起作用
有人知道如何解决这个问题吗
谢谢!
Bart错误信息显示
jdbc://selectAll
,看起来您的数据源url不正确。如果查看MySql连接器教程示例,url的样式应该是jdbc:mysql://localhost:3306/mulesoft_db
此配置适合我
<db:generic-config name="Generic_Database_Configuration" url="jdbc:postgresql://localhost/isnews?password=postgres&user=goncalodias" driverClassName="org.postgresql.Driver" doc:name="Generic Database Configuration">
</db:generic-config>
<db:mysql-config name="MySQL_Configuration" host="localhost" port="3306" user="root" password="passwd" database="IS" doc:name="MySQL Configuration"/>
谢谢!查看SQL数据源。来源是好的,但用户没有工作。我已经为Mule创建了一个用户,主机为Any(在phpMyAdmin中)。我将主机更改为localhost,并且工作正常。请查看页面roytuts.com/mule-jdbc-insert-example/