Question

I have 2 projects that both use a same mySQL database. One is a Master/Detail desktop application, the other one is a JSF Crud using PrimeFaces-4.0. - Although my JDBC Connection is UTF-8 as:

jdbc:mysql://localhost:3306/db_name?useUnicode=yes&characterEncoding=UTF-8
  • Database fields are also utf-8_general_ci
  • And I defined Glassfish JDBC properties as: useUnicode , true characterSetResults , UTF-8 characterEncoding , UTF-8

But I still get '?' characters into my DB when I input non-English Strings!

Was it helpful?

Solution

I had the same issue when we started to use Hibernate. Assing additional configuration to the connection URL didn't solve the problem, however we did add the following properties

<property name="hibernate.connection.characterEncoding">utf8</property>
<property name="hibernate.connection.useUnicode">true</property>
<property name="hibernate.connection.charSet">UTF-8</property> 

and that what solve the problem. Try removing parameters from URL string and leave it be so it would be just like

jdbc:mysql://localhost:3306/db_name

I hope it will solve your problem.

EDIT: I just noticed that you are not using Hibernate at all so this will not help you ;/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top