Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-989

Binary column read as String

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 3.0.5
    • 3.0.7
    • MySQL compatibility
    • None
    • Spring-boot 2.7.1
      Java 17
      MariaDB 10.3.35

    Description

      We have an issue with a byte array stored in a BINARY column.

      We store a UUID in a BINARY(16) column. We convert the UUID to a byte[] before writing. We convert back from byte[] to UUID when reading.

      We migrated from Spring-boot 2.6.8 to Spring-boot 2.7.1. The new 2.7.1 version comes with mariadb-java-connector:3.0.5 (with Spring-boot 2.6.X it was the 2.7.X versions).

      With this new version, we have a NumberFormatException thrown when reading UUIDs from the DBs. The UUID is correctly stored as byte[], but read as String in the JDBC ResultSet.

      How to reproduce

      I created a repository to reproduce the issue. This repository contains a simple Entity, EntityWithUuid. There is a Spring Data JDBC repository, EntityWithUuidRepository and its related test, EntityWithUudRepositoryTest.

      To reproduce the issue:

      • Launch the Mariadb service with this command:
        docker-compose up -d
      • Launch the test:
        ./gradlew test

      Expected result: The test is successful.

      Actual result: The test fails because of a ConversionFailedException

      Attachments

        Issue Links

          Activity

            People

              diego dupin Diego Dupin
              loictosser Loic Tosser
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.