I am using Java Server Pages and got problem with collation when inserting data from my application. My insert code looks like this:
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/myapp", "root", "");
Statement st=con.createStatement();
ResultSet rs;
st.executeUpdate("insert into table values (default,1,2,šđžćč)"); %>
In my database result looks like this š?ž?? (so he can see understand 2 letters but not all). How to fix it so all letters will be in my database?
EDIT :
I can insert data with those characters via phpmyadmin, but i can't from .jsp file to database. It's like charset = utf-8 on my jsp file is not working.
解决方案
Problem solved with adding to my connection from old path
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/myapp", "root", "");
to
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/myapp?useUnicode=true&characterEncoding=UTF-8", "root", "");