SQL Удалить запрос не работает в apache верблюд - PullRequest
0 голосов
/ 26 февраля 2020

SQL Запрос удаления не работает в верблюде, так как он застрял в запросе SQL и ничего не происходит. Попытался выполнить тот же запрос в БД напрямую, он работает нормально, как и ожидалось. Ниже приведен проблеск кода.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    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.xsd          http://camel.apache.org/schema/spring         http://camel.apache.org/schema/spring/camel-spring.xsd">
    <bean class="org.apache.commons.dbcp2.BasicDataSource"
        destroy-method="close" id="OracleConnection">
        <property name="driverClassName"
            value="${Oracle.DB.DriverClassName}" />
        <property name="url" value="${Oracle.DB.Url}" />
        <property name="username" value="${Oracle.DB.Username}" />
        <property name="password" value="${Oracle.DB.Password}" />
        <property name="initialSize" value="${Oracle.DB.InitialSize}" />
        <property name="maxTotal" value="${Oracle.DB.MaxTotal}" />
        <property name="minIdle" value="${Oracle.DB.MinIdle}" />
        <property name="maxIdle" value="${Oracle.DB.MaxIdle}" />
        <property name="testOnBorrow" value="true" />
        <property name="testOnReturn" value="true" />
        <property name="removeAbandonedOnMaintenance" value="true" />
        <property name="defaultAutoCommit" value="true" />
        <property name="maxWaitMillis"
            value="${Oracle.DB.MaxWaitMillis}" />
    </bean>
    <!-- configure the Camel SQL component to use the JDBC data source -->
    <bean class="org.apache.camel.component.sql.SqlComponent" id="sql">
        <property name="dataSource" ref="OracleConnection" />
    </bean>
    <camelContext id="GenerateOTPContext"
        xmlns="http://camel.apache.org/schema/spring">
        <route id="GenerateOTPMainRoute" streamCache="true">
            <from id="_from1"
                uri="restlet:http://localhost:9092/ESB/dbserviceapi/generateOTP?restletMethod=POST" />
            <setHeader headerName="deleteQuery" id="_setHeader2">
                <simple>sql:DELETE FROM MOBILE_OTP_DETAILS WHERE created_dt &lt; SYSDATE - INTERVAL '20' MINUTE</simple>
            </setHeader>
            <log id="_log2" message="Delete query ${header.deleteQuery}" />
            <recipientList delimiter="~" id="_recipientList2"
                ignoreInvalidEndpoints="true">
                <simple>${header.deleteQuery}</simple>
            </recipientList>
            <onException id="_onException1" useOriginalMessage="true">
                <exception>java.sql.SQLException</exception>
                <exception>java.lang.Exception</exception>
                <handled>
                    <constant>true</constant>
                </handled>
                <log id="_log3"
                    message="ESBUUID : ${exchangeId} Exception occurred in GenerateOTPAdapter : ${exception.stacktrace}" />
            </onException>
        </route>
    </camelContext>
</beans>

Я использую компоненты dbcp2, pool2 и camel- sql для подключения к БД.

Любые предложения, пожалуйста?

1 Ответ

0 голосов
/ 27 февраля 2020

Обнаружив проблему, я создал свою собственную таблицу, но не смог предоставить разрешение на удаление, поэтому он не удалял данные в БД из компонентов верблюда, поэтому я предоставил разрешение для своей таблицы, и это сработало.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...