开发者

Can I execute any program outside mysql through mysql triggers?

开发者 https://www.devze.com 2022-12-14 10:50 出处:网络
I’m building email notification service, requirement is to send an email to user when he is registered.

I’m building email notification service, requirement is to send an email to user when he is registered. Currently what I’m thinking of execution of some function defined in trigger, can be a java function, which have to be outside the mysql process, rather monitoring mysql from outside for row addition in database.

Is there any f开发者_高级运维unctionality available in mysql, so that I can execute my java function from database triggers?


If you're using Java for the front end to a database, why not do it in the Java middle tier code instead of the trigger? Databases are for persistence. If you decide to use another form of notification later on you'll find it's easier to add it to Java rather than MySQL.


You could via user defined functions, but it wouldn't be good practice IHMO, since your DB stores the data, while your application does (most of) the business logic. Adding email notifications to the business tier shouldn't be complicated either.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号