MySQL DB writer encoding issue

Hello to the Knime community,

I am having a problem with the “DB writer” node when I’m trying to add rows into a MySQL DB: when I check the table in the DB, special Polish or Turkish characters are replaced by “?” on import. I checked the encoding and collation for the specific column in the DB I am trying to import these characters to, and they are set to UTF8, utf8_general_ci respectively.

And indeed when I try to add these characters myself to the column, they are correctly interpreted and accepted by the DB.

So I suspect the problem comes from the DB writer itself, which does not process UTF8 encoding when adding new rows to the DB. I searched Knime forums and someone had a very similar issue to mine a while ago: mysql character encoding problem

The solution is apparently to add
jdbc:mysql://:/<database_name>?useUnicode=true&characterEncoding=utf8
to the “SQL URL” but I have no idea where to make that change, or even if one can still make that change in the latest version of Knime. Any help would be greatly appreciated.

Thank you!
Cheers,
Berti

Hi @Berti1989,

I haven’t got a database to test this on, but generally additional jdbc parameters can be added on the “jcbc parameters” tab of the DB Connector.

On the MySQL Connector, try adding the following parameters (I think they are normally case sensitive, so take care in writing them correctly).

Looking on the web, I have also seen mention of MySql jdbc parameters as:

characterEncoding=UTF-8
characterSetResults=utf8

so you may need to try different options and see which works, and if utf8 doesn’t work, try setting it to UTF-8
I hope that helps

4 Likes

Hi @takbb :slight_smile:
Thank you for your answer. It works! I added “characterEncoding” in the column “Name” and “utf8” in the column “Value” and that definitely solved my issue.

Thanks again!
Cheers,
Berti

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.