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

Insert of emoji in a column with collation utf8mb4 doesn't work

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.1.7
    • 1.1.8
    • None
    • None
    • MySQL 5.6.17
      MariaDB JDBC Driver 1.1.7
      Mac OS X 10.9.2 Mavericks

    Description

      I get this error

      org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO mytable (id, field1, field2, field3) VALUES (?, ?, ?, ?)]; SQL state [HY000]; error code [1366]; Incorrect string value: '\xF0\x9F\x98\x84"}' for column 'field3' at row 1; nested exception is java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x84"}' for column 'field3' at row 1
      (...)
      Caused by: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x84"}' for column 'payload' at row 1
      	at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:149)
      	at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106)
      	at org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:264)
      	at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:288)
      	at org.mariadb.jdbc.MySQLStatement.executeUpdate(MySQLStatement.java:317)
      	at org.mariadb.jdbc.MySQLPreparedStatement.executeUpdate(MySQLPreparedStatement.java:156)
      	at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:916)
      	at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:909)
      	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
      	... 78 more
      Caused by: org.mariadb.jdbc.internal.common.QueryException: Incorrect string value: '\xF0\x9F\x98\x84"}' for column 'payload' at row 1
      	at org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult(MySQLProtocol.java:942)
      	at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:991)
      	at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:281)
      	... 83 more

      The connection string is:

      jdbc:mysql://127.0.0.1:3306/mydatabase?useUnicode=yes&useConfigs=maxPerformance\

      The database is properly configured:

      flozano:/etc$ cat my.cnf
      [mysqld]
      character-set-server=utf8mb4

      ���
      field3 is defined as:

      `field3` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci

      Connector/J can perform exactly the same query against the exactly same database with the same data.

      Attachments

        Issue Links

          Activity

            People

              massimo.siani Massimo Siani (Inactive)
              flozano Francisco Lozano
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.