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

PreparedStatement::getParameterMetaData always returns VARSTRING as type resulting in downstream libraries interpreting values wrongly

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 2.2.6
    • 2.3.0, 1.8.0
    • metadata
    • None
    • MySQL 5.7.14

    Description

      When `PreparedStatement::getParameterMetaData` is performed for a query (for example, an insert query), the sql type for the parameters reports a wrong type, in fact, it is always VARSTRING.

      From https://jira.mariadb.org/browse/CONJ-568, I understand it's because the MariaDB server doesn't return the parameter types, and I have a feeling in my case, the MySQL server isn't returning parameter types as well.

      However, I personally feel this is wrong. Instead of returning a wrong type, it should throw an exception instead. See how MySql connector does it. Returning wrong types will lead downstream libraries to act on these wrong types and produce wrong results. If an exception is thrown, downstream libraries can act on the exception and perform other/fallback actions.

      Because of MariaDB connector returning wrong values, I have to write code to specifically ignore parameter metadata if the jdbc connector is of MariaDB type.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            isengrim Isen
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.