could you please help with troubleshooting issue.
I'm trying to insert cyrillic symbols from jsp to mysql table. Seems, i've tried everything. It actually happened when i've changed method 'GET' on 'POST' of input form.
I've made DB connection pool in NetBeans and here is my URL:
jdbc:mysql://localhost:3306/DBSite?useUnicode=true;characterEncoding=UTF-8;zeroDateTimeBehavior=convertToNull [DBSite_user on Default schema]
I've added filter:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
chain.doFilter(request, response);
}
It changed this symbols пппп on that ??????. So, it works a bit.
I've added
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
If I'm adding cyrillic text to MySQL by MySQL Workbench - everything is OK.
When I do mistake in SQL Update(deliberately) I can see in error message that HTML trying to send cyrillic 'вара', but in fact mysql inserting '????'
javax.servlet.ServletException:
insert into Comments(commentп, date_creation, id_title)
values ('вара',STR_TO_DATE('23-07-2018 17:52:07', '%d-%m-%Y %H:%i:%s'), 31);
: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?, date_creation, id_title)
values ('????',STR_TO_DATE('23-07-2018 17:52:07' at line 1
root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?, date_creation, id_title)
values ('????',STR_TO_DATE('23-07-2018 17:52:07' at line 1
I will appreciate if you help me find where it is changed, in what moment. And how can I debug it at least(server log, for example)? By the way, I'm using NetBeans and GlassFish.