I have the following line in my code :
int check1 = stmt3.executeUpdate("update ShopSystem.Grocery where g_id="+g_id+" set g_name="+g_name);
It is showing me the following error :
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 'where g_id=5 set g_name=Chikoo' at line 1
I think its because what is actually being passed to the SQL Server is : "update ShopSystem.Grocery where g_id=5 set g_name=Chikoo;
g_name is actually a String type. How should I pass that as a string in java print statement? Or is there any other mistake in my syntax?