Hi Daniel, Thanks for your message. You can easily override jOOQ's DefaultBinding by implementing your own data type Binding, and by using the code generator to bind that binding to all the relevant columns: https://www.jooq.org/doc/latest/manual/sql-building/queryparts/custom-bindings
Do note that the encoding used by client / server depends on a variety of settings, including the collation of the server, of the individual column, of the driver (you can override things in the JDBC connection string) and on the JVM. Hope this helps, Lukas 2017-10-30 1:28 GMT+01:00 Daniel <[email protected]>: > Hi Lukas, > > I have a similar issue, and it looks like a JDBC bug: > https://bugs.mysql.com/bug.php?id=80631 > > The 6.0.5 release log claims they've solved the issue, but the problem > still applies to normal VARCHAR columns. > I tried converting the table from latin1 to utf8mb4, changing the > characterSetResults to latin1, then utf8, but nothing works. > > The only thing that works is using ResultSet.getBytes instead of getString: > > new String(res.getBytes("columnName"), "UTF-8") > > Is there any way I can get JOOQ to use getBytest instead of getString? > > Thanks, > Daniel > > > jOOQ just passes Strings through to JDBC and fetches them from JDBC >> without interfering with encoding. So, I suspect this may be related to the >> JDBC driver settings. MySQL knows JDBC driver properties such as: >> >> - characterEncoding >> - characterSetResults >> - connectionCollation >> >> More information here: >> https://dev.mysql.com/doc/connector-j/8.0/en/connector-j- >> reference-configuration-properties.html >> >> Does that help? >> >> 2017-07-20 11:14 GMT+02:00 <[email protected]>: >> >>> Hi, >>> >>> I have a mysql database where all of its content are encoded as latin1, >>> when I fetch the data it tries to convert to utf8 and it messes up >>> everything. >>> The best way we got to solve this was with this ugly line of code: >>> >>> >>> content = Field( >>> >>> "convert(cast(convert(" + TABLE_NAME + ".content using latin1) as >>> binary) using utf8)", >>> String.class So, is there a better way to do this? >>> Thanks, David >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "jOOQ User Group" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
