Skip to content

[CAMEL-23481] replacing retired Apache Derby with HSQL and MariaDB in camel-sql#23597

Open
tmielke wants to merge 7 commits into
apache:mainfrom
tmielke:replace-derby
Open

[CAMEL-23481] replacing retired Apache Derby with HSQL and MariaDB in camel-sql#23597
tmielke wants to merge 7 commits into
apache:mainfrom
tmielke:replace-derby

Conversation

@tmielke
Copy link
Copy Markdown

@tmielke tmielke commented May 28, 2026

[CAMEL-23481] replacing retired Apache Derby with HSQL and MariaDB for stored procedures and stored function tests in sql-stored: component.
While HSQL has support for stored procedures, it does not support SQL stored functions, neither does H2 support them.
So using an embedded MariaDB4j instance to test SQL stored functions in class SqlFunctionDataSourceTest.
Running an embedded MariaDB4j instance is slower to initialize, so using it only for the single test class SqlFunctionDataSourceTest.

Made with help from AI tools.

Torsten Mielke and others added 4 commits May 18, 2026 13:59
stored procedures and stored function tests in sql-stored: component.
While HSQL has support for stored procedures, it does not support
SQL stored functions, neither does H2 support them.
So using an embedded MariaDB4j instance to test SQL stored functions
in class SqlFunctionDataSourceTest.
Running an embedded MariaDB4j instance is slower to initialize,
so using it only for the single test class SqlFunctionDataSourceTest.

Made with help from AI tools.
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@davsclaus
Copy link
Copy Markdown
Contributor

It seems derby is using as testing for some other components

Error: The project org.apache.camel:camel-spring-jdbc:4.21.0-SNAPSHOT (/home/runner/work/camel/camel/components/camel-spring-parent/camel-spring-jdbc/pom.xml) has 2 errors
Error: 'dependencies.dependency.version' for org.apache.derby:derby:jar must be a valid version but is '${derby-version}'. @ line 67, column 22
Error: 'dependencies.dependency.version' for org.apache.derby:derbytools:jar must be a valid version but is '${derby-version}'. @ line 73, column 22
Error:
Error: The project org.apache.camel:camel-spring-xml:4.21.0-SNAPSHOT (/home/runner/work/camel/camel/components/camel-spring-parent/camel-spring-xml/pom.xml) has 2 errors
Error: 'dependencies.dependency.version' for org.apache.derby:derby:jar must be a valid version but is '${derby-version}'. @ line 137, column 22
Error: 'dependencies.dependency.version' for org.apache.derby:derbytools:jar must be a valid version but is '${derby-version}'. @ line 143, column 22
Error:
Error: The project org.apache.camel:camel-jcr:4.21.0-SNAPSHOT (/home/runner/work/camel/camel/components/camel-jcr/pom.xml) has 2 errors
Error: 'dependencies.dependency.version' for org.apache.derby:derby:jar must be a valid version but is '${derby-version}'. @ line 69, column 22
Error: 'dependencies.dependency.version' for org.apache.derby:derbytools:jar must be a valid version but is '${derby-version}'. @ line 75, column 22
Error:
Error: The project org.apache.camel:camel-jdbc:4.21.0-SNAPSHOT (/home/runner/work/camel/camel/components/camel-jdbc/pom.xml) has 2 errors
Error: 'dependencies.dependency.version' for org.apache.derby:derby:jar must be a valid version but is '${derby-version}'. @ line 68, column 22
Error: 'dependencies.dependency.version' for org.apache.derby:derbytools:jar must be a valid version but is '${derby-version}'. @ line 74, column 22
Error:
Error: The project org.apache.camel:camel-jpa:4.21.0-SNAPSHOT (/home/runner/work/camel/camel/components/camel-jpa/pom.xml) has 2 errors
Error: 'dependencies.dependency.version' for org.apache.derby:derby:jar must be a valid version but is '${derby-version}'. @ line 95, column 22
Error: 'dependencies.dependency.version' for org.apache.derby:derbytools:jar must be a valid version but is '${derby-version}'. @ line 101, column 22
Error:
Error: The project org.apache.camel:camel-mybatis:4.21.0-SNAPSHOT (/home/runner/work/camel/camel/components/camel-mybatis/pom.xml) has 2 errors
Error: 'dependencies.dependency.version' for org.apache.derby:derby:jar must be a valid version but is '${derby-version}'. @ line 58, column 22
Error: 'dependencies.dependency.version' for org.apache.derby:derbytools:jar must be a valid version but is '${derby-version}'. @ line 64, column 22
Error:
Error: The project org.apache.camel:camel-quartz:4.21.0-SNAPSHOT (/home/runner/work/camel/camel/components/camel-quartz/pom.xml) has 2 errors
Error: 'dependencies.dependency.version' for org.apache.derby:derby:jar must be a valid version but is '${derby-version}'. @ line 111, column 22
Error: 'dependencies.dependency.version' for org.apache.derby:derbytools:jar must be a valid version but is '${derby-version}'. @ line 117, column 22
Error:
Error: The project org.apache.camel:camel-itest:4.21.0-SNAPSHOT (/home/runner/work/camel/camel/tests/camel-itest/pom.xml) has 2 errors
Error: 'dependencies.dependency.version' for org.apache.derby:derby:jar must be a valid version but is '${derby-version}'. @ line 184, column 22
Error: 'dependencies.dependency.version' for org.apache.derby:derbytools:jar must be a valid version but is '${derby-version}'. @ line 190, column 22

@tmielke
Copy link
Copy Markdown
Author

tmielke commented May 28, 2026

Yes, I initially replaced Derby in all components that use it but realised there are quite some changes and decided to go component by component. I need to reintroduce Derby until the last component does not use it. Let me fix that.

Comment thread parent/pom.xml Outdated
Comment thread components/camel-sql/pom.xml Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

🧪 CI tested the following changed modules:

  • components/camel-sql
  • parent

POM dependency changes: targeted tests included

Changed properties: mariadb-version, mariadb4j-version

Modules affected by dependency changes (1)
  • :camel-sql
All tested modules (10 modules)
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: JTA
  • Camel :: Kafka
  • Camel :: Launcher :: Container
  • Camel :: SQL
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

Copy link
Copy Markdown
Contributor

@davsclaus davsclaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for tackling the Derby replacement — this is useful work and the HSQLDB migration for stored procedures looks solid.

I found a couple of issues that need to be addressed before merging:

  1. MariaDB4j version 3.3.1 does not exist on Maven Central — the latest released version is 3.2.0. Please verify the correct version.

  2. MariaDB4j lacks ppc64le/s390x native binaries — Camel CI tests on amd64, ppc64le, and s390x. MariaDB4j only ships binaries for linux64 (x86_64), macos-arm64, and win-x64. SqlFunctionDataSourceTest will fail on those architectures. Consider skipping it on unsupported archs via skipITs.ppc64le / skipITs.s390x Maven properties or a JUnit condition.

  3. Tab characters in components/camel-sql/pom.xml and parent/pom.xml — the project uses 4-space indentation.

  4. Commented-out debug code — three test classes have identical commented-out static {} blocks that are superseded by the surefire configuration. These should be removed.

  5. Missing trailing newlines in several SQL files.

This review is a project-rules and conventions check. It does not replace specialized review tools such as CodeRabbit or SonarCloud.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Claus Ibsen

Comment thread parent/pom.xml Outdated
Comment thread parent/pom.xml Outdated
Comment thread parent/pom.xml Outdated
<debezium-mysql-connector-version>9.7.0</debezium-mysql-connector-version>
<derby-version>10.16.1.1</derby-version>
<debezium-mysql-connector-version>9.7.0</debezium-mysql-connector-version>
<derby-version>10.16.1.1</derby-version>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<derby-version>10.16.1.1</derby-version>
<derby-version>10.16.1.1</derby-version>

Comment thread components/camel-sql/pom.xml Outdated
Comment thread components/camel-sql/pom.xml
private TemplateParser templateParser;
private EmbeddedDatabase db;
private JdbcTemplate jdbcTemplate;
private CallableStatementWrapperFactory factory;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commented-out static {} block is unnecessary since the hsqldb.method_class_names property is already set via the surefire plugin configuration in pom.xml. Please remove this dead code (also applies to ProducerInOutTest and ProducerTest).

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MariaDB4j ships native binaries only for linux64 (x86_64), macos-arm64, and win-x64. Camel CI also tests on ppc64le and s390x, where this test will fail because no MariaDB binary is available.

Consider:

  • Adding skipITs.ppc64le and skipITs.s390x Maven properties in the POM, or
  • Using a JUnit @DisabledIfSystemProperty / architecture check to skip on unsupported platforms.

Copy link
Copy Markdown
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good migration away from the retired Apache Derby to HSQLDB and MariaDB4j. The approach is sound: HSQLDB for most embedded tests, MariaDB4j for stored procedure tests that need more advanced SQL features.

Two minor observations:

  1. Tab characters in pom.xml — there are a few tab characters mixed with spaces in the dependency indentation (e.g., the H2 dependency block). The project uses spaces consistently, and this may fail the mvn formatter:format CI check.

  2. Commented-out static blocks — the hsqldb.method_class_names static initializer blocks in CallableStatementWrapperTest.java and ProducerInOutTest.java are commented out with a "useful for debugging" note. The surefire plugin systemProperty approach (in pom.xml) already handles this at build time, so these commented blocks are redundant. Consider removing them to keep the test code clean.

The ID value adjustments (1-based → 0-based) are correctly handled in the test assertions. Removing the shouldExecuteStoredFunction() test and the "it seems not to work with Derby" comment in SqlGeneratedKeysTest are clean improvements.

LGTM — the formatting issues are minor and easily fixable.

Fully automatic review from Claude Code

@davsclaus
Copy link
Copy Markdown
Contributor

LGTM talked to Torsten

- replace any tab characters with white spaces
- upgrade MariaDB client to latest 3.5.8 release
- restrict SqlFunctionDataSourceTest to be only run on Linux, MacOS and
  Windows

Made with help from AI tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants