2
I have to do a Java project that automatically sends an email taking data such as name, CNPJ, etc. in the Oracle database every day at 10:00 am. How to create this?
2
I have to do a Java project that automatically sends an email taking data such as name, CNPJ, etc. in the Oracle database every day at 10:00 am. How to create this?
0
You will need several things separately, first of them and a crontab running every day at 10:00AM, second and a correctly configured SMTP server, only after that should you create a bank access class and email triggering.
0
There are many ways to do this, many even.
One that I consider quite usual in the market is to use the Quartz Scheduler, a task scheduler that supports distributed environments (cluster) and can be run in an integrated way with the Spring Framework.
In that case, just create a task that fires at the desired time using the same command pattern cron
unix. Example:
0 0 10 ? * *
The above expression sets the daily run to 10 am, exact time, no seconds or minutes.
Using the Spring framework can help with other tasks such as setting up and sending email, connecting to the database, injecting component dependency, etc.
For more details on how to set up Quartz with Spring, see documentation. See also tutorials and examples here and here.
Depending on the volume of emails, you can also integrate Spring Batch to send emails at certain intervals. So, in this scenario, Quartz’s task would trigger Spring Batch’s task to send emails.
Would Brother Oce have some sample project so I could get a better understanding of this thing? Thanks.
@Wesleycosta The projects I have are confidential, but if you follow the tutorials and examples I passed you have what it takes to set up Spring with Quartz. In the part of accessing the database, you can use this other example with Spring Jdbctemplate. To send email please see this and this other link.
I was able to make a class that sends emails in the time that I set, and I was also able to create a class that connects to the bank and brings me the information that I need, now how do I make the two are in tune so that there can be the filling of the body of the email with the data of the debtor client?? if you can help me friend @utuluiz
@Wesleycosta Here comes an object orientation problem. You still don’t know the concepts of creating a class, a method, then importing it into another class? You’d better study the Java language a bit. Unfortunately I’m running out of time to give you a more chewed-up solution.
blz, amigo I think this really is my problem rsrs.. good more I’ll see what I can do here... thanks
Browser other questions tagged java-ee
You are not signed in. Login or sign up in order to post.
not wanting to be boring, more like it would be this?
– Wesley Costa