diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java index 318807947d..5e342cade4 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java @@ -519,7 +519,7 @@ public class JDBCPersistenceAdapter extends DataSourceSupport implements Persist e = e.getNextException(); s += ", due to: " + e.getMessage(); } - LOG.debug(s, e); + LOG.warn(s, e); } public Statements getStatements() { diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java index 5b11b5d34a..1493dde5c5 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.TreeSet; @@ -335,8 +336,13 @@ public class DefaultJDBCAdapter implements JDBCAdapter { s = c.getConnection().prepareStatement(this.statements.getFindAllMessageIdsStatement()); s.setMaxRows(limit); rs = s.executeQuery(); + // jdbc scrollable cursor requires jdbc ver > 1.0 andis often implemented locally so avoid + LinkedList reverseOrderIds = new LinkedList(); while (rs.next()) { - listener.messageId(new MessageId(rs.getString(2), rs.getLong(3))); + reverseOrderIds.addFirst(new MessageId(rs.getString(2), rs.getLong(3))); + } + for (MessageId id : reverseOrderIds) { + listener.messageId(id); } } finally { close(rs);