wso2 esb dblookup мисс параматер - PullRequest
1 голос
/ 07 ноября 2019

Я установил переменную, прежде чем использовать dplookup для выбора результата, параметр:

mc.setProperty("year","2019");
mc.setProperty("month","11");
mc.setProperty("date","7");

dblookup равен

<dblookup>
    <connection>
        <pool>
            <password>XXXX</password>
            <driver>com.mysql.jdbc.Driver</driver>
            <url>jdbc:mysql://XXXX</url>
            <user>XXXX</user>
        </pool>
    </connection>
    <statement>
        <sql><![CDATA[
            SELECT IFNULL(max(ID_),0) as MAX_ID_ FROM KETTLE WHERE YEAR(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ? AND MONTH(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ? AND DAYOFMONTH(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ?;
        ]]></sql>
        <parameter expression="get-property('year')" type="VARCHAR"/>
        <parameter expression="get-property('month')" type="VARCHAR"/>
        <parameter expression="get-property('date')" type="VARCHAR"/>
        <result column="MAX_ID_" name="MAX_ID_"/>
    </statement>
</dblookup>

Иногда это работает, иногда нетработа

при успешном ведении журнала:

TID: [-1234] [] [2019-11-07 15:11:40,072] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  Setting as parameter : 1 value : 2019 as JDBC Type : 12(see java.sql.Types for valid types) {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2019-11-07 15:11:40,073] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  Setting as parameter : 2 value : 11 as JDBC Type : 12(see java.sql.Types for valid types) {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2019-11-07 15:11:40,073] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  Setting as parameter : 3 value : 7 as JDBC Type : 12(see java.sql.Types for valid types) {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2019-11-07 15:11:40,073] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  Successfully prepared statement : 
                                SELECT IFNULL(max(ID_),0) as MAX_ID_ FROM KETTLE WHERE YEAR(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ? AND MONTH(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ? AND DAYOFMONTH(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ?;
                             against DataSource : jdbc:XXXX{org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2019-11-07 15:11:40,235] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  Processing the first row returned : 
                                SELECT IFNULL(max(ID_),0) as MAX_ID_ FROM KETTLE WHERE YEAR(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ? AND MONTH(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ? AND DAYOFMONTH(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ?;
                             {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2019-11-07 15:11:40,235] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  Column : MAX_ID_ returned value : 0 Setting this as the message property : MAX_ID_ {org.apache.synapse.mediators.db.DBLookupMediator}

при сбое при ведении журнала:

TID: [-1234] [] [2019-11-07 09:29:50,073] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  Getting a connection from DataSource jdbc:mysql://XXXX and preparing statement : 
                                SELECT IFNULL(max(ID_),0) as MAX_ID_ FROM KETTLE WHERE YEAR(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ? AND MONTH(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ? AND DAYOFMONTH(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ?;
                             {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2019-11-07 09:29:50,074] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  [ DB Connection : org.apache.commons.dbcp.PoolableConnection@1ff8a7ec ] {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2019-11-07 09:29:50,075] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  [ DB Connection instance identifier : 1ff8a7ec ] {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2019-11-07 09:29:50,075] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  [ Number of Active Connection : 1 ] {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2019-11-07 09:29:50,075] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  [ Number of Idle Connection : 0 ] {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2019-11-07 09:29:50,075] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} -  Setting as parameter : 1 value : 2019 as JDBC Type : 12(see java.sql.Types for valid types) {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2019-11-07 09:29:50,075] ERROR {org.apache.synapse.mediators.db.DBLookupMediator} -  SQL Exception occurred while executing statement : 
                                SELECT IFNULL(max(ID_),0) as MAX_ID_ FROM KETTLE WHERE YEAR(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ? AND MONTH(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ? AND DAYOFMONTH(FROM_UNIXTIME(DETECTION_TIME_ / 1000)) = ?;
                             against DataSource : jdbc:mysql:XXXXX{org.apache.synapse.mediators.db.DBLookupMediator}
java.sql.SQLException: No operations allowed after statement closed.
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...