COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'
See original GitHub issueGetting the title error on my linux machine. Works great with the windows test-server on the same database (cloned) and the same code.
I am using utf8mb4_general_ci as standard collation, but utf8mb4_bin at column “token”.
I think the part (`lime`.`user`.`token` = ? COLLATE utf8_bin)
should use utf8mb4_bin instead?
Interestingly enough: It does not help when I convert the column token to utf8_bin!
Stacktrace
2017-06-08T18:10:42.336Z INFO [http-nio-8080-exec-1] (#APPLICATION_BUILDER) - Speedment (Open Source) version 3.0.10 by Speedment, Inc. Specification version 3.0
2017-06-08T18:10:42.336Z INFO [http-nio-8080-exec-1] (#APPLICATION_BUILDER) - Java Platform API Specification 1.8 by Oracle Corporation. Implementation N/A 1.8.0_131 by N/A
2017-06-08T18:10:42.655Z INFO [http-nio-8080-exec-1] (#APPLICATION_BUILDER) - MySQL, 10.0.29-MariaDB-0ubuntu0.16.10.1, MariaDB connector/J 2.0.2, JDBC version 4.2
2017-06-08T18:10:42.852Z ERROR [http-nio-8080-exec-3] (c.s.r.c.i.d.AsynchronousQueryResultImpl) - Error executing SELECT `id`,`token`,`firebase`,`initial`,`timestamp_location`,`distance`,`longitude`,`latitude` FROM `lime`.`user` WHERE (`lime`.`user`.`token` = ? COLLATE utf8_bin), values=[sometoken]
java.sql.SQLSyntaxErrorException: (conn:18774) COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:158)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:118)
at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:245)
at org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:218)
at org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:153)
at org.mariadb.jdbc.MariaDbPreparedStatementClient.executeQuery(MariaDbPreparedStatementClient.java:167)
at com.speedment.runtime.core.internal.db.AsynchronousQueryResultImpl.stream(AsynchronousQueryResultImpl.java:95)
at com.speedment.runtime.core.internal.component.sql.SqlStreamSupplierImpl.lambda$stream$6(SqlStreamSupplierImpl.java:184)
at com.speedment.runtime.core.internal.stream.builder.pipeline.PipelineImpl.getStream(PipelineImpl.java:85)
at com.speedment.runtime.core.internal.stream.builder.pipeline.PipelineImpl.getAsReferenceStream(PipelineImpl.java:63)
at com.speedment.runtime.core.internal.component.sql.override.def.reference.DefaultFindAnyTerminator.apply(DefaultFindAnyTerminator.java:45)
at com.speedment.runtime.core.internal.manager.sql.SqlStreamTerminator.findAny(SqlStreamTerminator.java:176)
at com.speedment.runtime.core.internal.stream.builder.ReferenceStreamBuilder.lambda$findAny$16(ReferenceStreamBuilder.java:406)
at com.speedment.runtime.core.internal.stream.builder.AbstractStreamBuilder.finallyCloseReference(AbstractStreamBuilder.java:189)
at com.speedment.runtime.core.internal.stream.builder.ReferenceStreamBuilder.findAny(ReferenceStreamBuilder.java:406)
Database
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:13 (7 by maintainers)
Top Results From Across the Web
COLLATION 'utf8_bin' is not valid for CHARACTER SET ...
Collations are specific to a character set. If your character set is utf8mb4, then you could use collation utf8mb4_bin but not utf8_bin.
Read more >Error reading from database - COLLATION 'utf8mb4_bin' is not ...
Error reading from database - COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'utf8' SELECT * FROM mdl_user WHERE LOWER(username) COLLATE utf8mb4_bin .....
Read more >Collation is not valid for character set - Moodle Wiki
COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'. It means you need to fix the collation on your database tables (MySQL/MariaDB).
Read more >[Sentinel] SQL Error COLLATION 'utf8_bin' is not valid for ...
[Sentinel] SQL Error COLLATION 'utf8_bin' is not valid for CHARACTER SET 'latin1' when accessing a report in Web-monitoring.
Read more >COLLATION utf8_unicode_ci is not valid for CHARACTER ...
This error shows up if you have different character and collation setting in your mysql server than what you are trying to source...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed by adding the following to my.ini
Komisch, nicht wahr? It might be the case that there are different defaults for the table collation on the two platforms. Try to re-create your table using “utf8” . We do our integration tests on Linux and here is one example of a table created for MariaDB: