I am working with MySql, Spring MVC.
When I run my code on my computer (localhost) it works fine. But after deploying it on remote server it shows Bad SQL grammar exception.
Here is screen shot from my remote server database custom error. (Screenshot from phpMyAdmin)
Here is the error in text formate:
PreparedStatementCallback; bad SQL grammar [insert into matchs (id, title, location, number_of_players, over, team1, team2, toss, status, result, team_init, match_end, match_started, match_views, bookmarked, announcement, tournament, create_date, start_date, active_date, asst_scorer, start_date_string) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'over, team1, team2, toss, status, result, team_init, match_end, match_started, m' at line 1
Here is my Java code to insert data in MySql Table
public boolean createMatch(Match match) {
BeanPropertySqlParameterSource params = new BeanPropertySqlParameterSource(match);
return jdbc.update(
"insert into matchs (id, title, location, number_of_players, over, team1, team2, toss, status, result, team_init, match_end, match_started, match_views, bookmarked, announcement, tournament, create_date, start_date, active_date, asst_scorer, start_date_string) values (:id, :title, :location, :number_of_players, :over, :team1, :team2, :toss, :status, :result, :team_init, :match_end, :match_started, :match_views, :bookmarked, :announcement, :tournament, :create_date, :start_date, :active_date, :asst_scorer, :start_date_string)",
params) == 1;
}