Problem with the encoding in connection with the access to a database

the problem that I have is very hard to describe. I try to be as accurate as possible.

I’m just writing a dictionary as a web application. I use at the moment a MySQL database, a Tomcat v6.0 Server and the java.sql class as well as Vaadin.

When the user types a search Term into a search box, all search results including translations are loaded from the database and are shown in a table. In the TextField, in the table and as well in other components all characters are displayed correctly .
However, for a search word with special characters such as the word “Młotek" (which was stored in the database for testing purposes), the program does not find any results, even though the word exists in the database.

A similar problem exists also when adding new words to the database via over the web application.
Here, the special characters are replaced with a question mark (From Młotek is e.g. M?otek). If I enter the word directly into the database, it is displayed correctly.

My first suspicion was that there may be problems with the string (in which I store the user input and add it to the SQL string). Therefore, I have saved the user input in a string and pass the value to another TextField. However, here the word was correctly displayed in the second TextField.

Next, I checked the settings.
The database and the database tables are set to UTF-8. I also selected UTF-8 in Preferences and Properties (see screenshot).

When I look at the default charset with:

 System.out.println ("charset: "+ Charset.defaultCharset());

I get the message that the default charset is also UTF-8.
Also in my Web.xml file UTF-8 is used. Just like in the XML file of the Tomcat server.

Here is some information about my environment:

Vaadin Version:

development environment:
Eclipse (Galileo)

System language:

I cannot explain what could be the problem. I do not have much experience and my internet search was not successful. Hence my plea for help at this point.

Did anyone have such a problem happen before and can help me?
Thanks in advance for your answers.

Best regards


It’s kind of hard to say what the problem is, as you do not specify how you’re connecting to the database. If you’re using JDBC to connect to your MySQL server, make sure that the Connection’s charset is UTF-8. You can do this by specifying it in the connection URL like so:



I use the JDBC to connect to my MySQL server. I tried your suggestion and it works great!
Many thanks you’ve helped me a lot.