0
插入數據的PostgreSQL無法讀取數據我有一個XML文件作爲下能正確地從XML同時使用騾子ESB,騾工作室
<Families>
<Family>
<title>Mr</title>
<name>Xyz</name>
</Family>
<Family>
<title>Mr</title>
<name>Mno</name>
</Family>
</Families>
我試圖讀取該文件與數據存儲到PostgreSQL數據庫。我的配置XML文件是根據
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:jdbc="http://www.mulesoft.org/schema/mule/jdbc" xmlns:file="http://www.mulesoft.org/schema/mule/file" 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="CE-3.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/jdbc http://www.mulesoft.org/schema/mule/jdbc/current/mule-jdbc.xsd
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 ">
<jdbc:postgresql-data-source name="PostgreSQL_Data_Source" user="superuser" password="pwd" url="jdbc:postgresql://localhost:5432/TestDB" transactionIsolation="UNSPECIFIED" doc:name="PostgreSQL Data Source"/>
<jdbc:connector name="Database-Connector" dataSource-ref="PostgreSQL_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database">
<jdbc:query key="InsertQuery" value="INSERT INTO "tblTest"(title, content)VALUES (#xpath://title,#xpath://name)"/>
</jdbc:connector>
<flow name="testxmlFlow1" doc:name="testxmlFlow1">
<file:inbound-endpoint path="C:\Users\nbiswas\Documents\InputFolder" responseTimeout="10000" doc:name="File"/>
<byte-array-to-string-transformer doc:name="Byte-Array-to-String"/>
<splitter evaluator="xpath" expression="/Families/Family" doc:name="Splitter"/>
<jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="InsertQuery" queryTimeout="-1" connector-ref="Database-Connector" doc:name="Database"/>
</flow>
</mule>
在運行時,我收到下面的錯誤(主要是)
Exception stack is:
1. ERROR: syntax error at or near ":"
Position: 52(SQL Code: 0, SQL State: + 42601) (org.postgresql.util.PSQLException)
org.postgresql.core.v3.QueryExecutorImpl:2157 (null)
2. ERROR: syntax error at or near ":"
Position: 52 Query: INSERT INTO "tblTest"(title, name)VALUES (#xpath://title,#xpath://name) Parameters: [](SQL Code: 0, SQL State: + 42601) (java.sql.SQLException)
org.apache.commons.dbutils.QueryRunner:540 (null)
我懷疑有什麼不對的
「VALUES( #xpath:// title,#xpath:// name)「
有人可以幫我解決問題嗎?
預先感謝