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

insert with no value on not null column accepted

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.0, 1.3.0
    • Fix Version/s: 1.4.0
    • Component/s: Other
    • Labels:
      None
    • Environment:
      Ubuntu 14.04, MySQL 5.5.43-0ubuntu0.14.04.1, MariaDB Connector/J 1.3.0

      Description

      I'm not sure if this is a bug or if it's intentional, but MariaDB Connector/J behaves differently from mysql-connector-java when inserting lines without values on not null columns, when sql_mode doesn't include STRICT_TRANS_TABLES.

      With this table:

      CREATE TABLE test1 (
          col1              VARCHAR(64) NOT NULL
      ) ;

      this statement:

      INSERT INTO test1 () VALUES ()

      succeeds with MariaDB Connector/J (1.3.0 and 1.2.0), but with mysql-connector-java (5.1.37), it throws a SQLException as a value for col1 is missing.

      If sql_mode is set to STRICT_TRANS_TABLES both drivers behave the same (throwing exception), so a work-around is maybe to add "?sessionVariables=sql_mode=STRICT_TRANS_TABLES" to the connection URL.

      (Storage engine is INNODB. Java-version on client is 8u60. Client runs on the same machine as the server.)

        Attachments

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            andreas Andreas Persson
            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.