From 7032da4e948babebc72019cee34a25e8422c3f32 Mon Sep 17 00:00:00 2001 From: Matt Pavlovich Date: Sun, 16 Nov 2025 12:34:46 -0600 Subject: [PATCH] [AMQ-9806] Add H2 database support --- .../store/jdbc/adapter/H2JDBCAdapter.java | 38 +++++++++++++++++++ .../store/jdbc/h2_database_engine_driver | 17 +++++++++ 2 files changed, 55 insertions(+) create mode 100644 activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/H2JDBCAdapter.java create mode 100644 activemq-jdbc-store/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/h2_database_engine_driver diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/H2JDBCAdapter.java b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/H2JDBCAdapter.java new file mode 100644 index 00000000000..4d1560ca1b9 --- /dev/null +++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/H2JDBCAdapter.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.store.jdbc.adapter; + +import org.apache.activemq.store.jdbc.Statements; + +/** + * + * @org.apache.xbean.XBean element="h2-jdbc-adapter" + */ +public class H2JDBCAdapter extends BytesJDBCAdapter { + + @Override + public void setStatements(Statements statements) { + statements.setBinaryDataType("BLOB"); + super.setStatements(statements); + } + + @Override + public String limitQuery(String query) { + return query + " LIMIT " + getMaxRows(); + } + +} diff --git a/activemq-jdbc-store/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/h2_database_engine_driver b/activemq-jdbc-store/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/h2_database_engine_driver new file mode 100644 index 00000000000..1513234f442 --- /dev/null +++ b/activemq-jdbc-store/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/h2_database_engine_driver @@ -0,0 +1,17 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- +class=org.apache.activemq.store.jdbc.adapter.H2JDBCAdapter \ No newline at end of file