gpt4 book ai didi

mysql - 骡子 MySQL 连接器

转载 作者:行者123 更新时间:2023-11-29 02:25:49 25 4
gpt4 key购买 nike

我正在尝试将 Mule 连接到 MySQL 数据库,使用本教程(对 Mule 来说非常新): http://www.mulesoft.org/connectors/mysql-connector

我一路向下,到第 6 步(测试列表项)。如果我转到指定的 URL,我会收到此错误:

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

我已经找了很长时间了,但找不到解决方案。也许你们能帮帮我?

这是我的 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。两者均无效。

有人知道如何解决这个问题:)?

谢谢!巴特

最佳答案

错误信息是jdbc://selectAll,看来你的数据源url不正确。如果您查看 MySql Connector 教程示例,则 url 的样式应为 jdbc:mysql://localhost:3306/mulesoft_db

关于mysql - 骡子 MySQL 连接器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22295333/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com