How can I add procedures and triggers to my MySQL database?

From their Java applications, as more and more clients want to use advanced SQL features,

we are running MySQL version 5.1.x or higher where user can run CREATE PROCEDURE and CREATE TRIGGER statements.

Just ensure when assigning database user to a database, you should check ROUTINE and TRIGGER related privileges or ALL privileges .
for more read on the statements in MySQL documentation:
Using command line ‘mysql’ client or any other client, you can create procedures.