I have a button in gwt and on each click i want that value should increase in the database. How should i do using stored procedure. Its like hitting like button and increasing the counter on the particular post. new for all this want help.
public String fun()
{
Connection con=null;
CallableStatement pt=null;
try
{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/check", "root", "root");
pt=(CallableStatement)con.prepareCall("{call ask (1)}");
pt.executeUpdate();
System.out.println("2");
}
con.close();
pt.close();
}
catch(Exception e)
{
e.printStackTrace();
}
return"";
}
}
STORED PROCEDURE:
DELIMITER $$
CREATE DEFINER=root
@localhost
PROCEDURE ask
(IN good int)
BEGIN
update likepost set hitlike=hitlike+1 where idlikepost=1 ;
END
TASK COMPLETED YIPEE!!!!