views:

41

answers:

1

I have a stored procedure that works in the mysql> terminal, but when I try to run it through my application it doesn't work. I don't get any error messages or anything. If I try to execute the sp through MySql Query Browser the response is simply :
"Query canceled."

This particular SP is just a simple update command, but I have other SP that are SELECT commands and they work.

Ive tried changing the DEFINER to '%' and '' but neither of that worked.

I'm thinking this has to be some kind of a permission problem or a my.cnf problem but I have no idea how to fix this nor do I seem to be able to find a solution on the internet machine :)

EDIT: I just tried to execute it from phpmyadmin and that worked. I tried both as root and myUser. What is going on ?

+1  A: 

If you can run select based stored procedures, and not the update one, the user you are connecting with query browser has insufficient privileges on some tables or columns updated by the stored procedure. You can check that with the user manager.

Obs: your_user@localhost seems to be ok as you can run with phpmyadmin but with query browser, the user is your_user@%.

laurent-rpnet
Thanks, aparently my % wasn't working (hadn't registered or something) because I tried removing it from root and myuser and adding it back again and voila it worked.
Bigginn
Hmm... I just tried another stored procedure that does updates on tables and got the same error as before while the old update sp worked. The only difference between the procedures (excluding the SQL command of course) was that I had changed the Definer to '%' from 'localhost' in the one that worked. I tried doing that to the new procedure and that made it work.
Bigginn
I guess this is because your_user@% has not the Execute privilege on the whole database and, by default, mysql gives EXEC privilege to the definer of the SP. You can find more detailed info in the beginning of http://dev.mysql.com/doc/refman/5.1/en/create-procedure.html
laurent-rpnet