If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Mail Notification using DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-16-08, 07:25
anoopsober anoopsober is offline
Registered User
 
Join Date: Dec 2008
Posts: 3
Mail Notification using DB2

Hi

Can anyone help me how to send out a mail notification to a user whose name is present in the table using a stored procedure? I need to run this stored procedure every monday so that it will check the database and send mail to those people to whom mail has to be sent according to the conditions specified in the stored Procedure.

All help appreciated.

Thanks and regards,
Anoop
Reply With Quote
  #2 (permalink)  
Old 12-16-08, 08:32
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
run the Stored-Proc inside a Shell-script schedulled in CRON/AUTOSYS. Let the Stored-Proc return the "USER-NAMES" as OUTPUT parameters and assign them as variable USER_NAME. Take them one by one in a WHILE or FOR Loop and run the unix/linux MAIL TO command with the variable $USER_NAME as the EMAIL_ID and send the mail one after another.
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
  #3 (permalink)  
Old 12-16-08, 16:53
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Or you write a stored procedure in C/C++ or Java to compose the email and use a system call for the actual sending.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #4 (permalink)  
Old 12-16-08, 22:56
anoopsober anoopsober is offline
Registered User
 
Join Date: Dec 2008
Posts: 3
Mail Notification using DB2

Thank you for the quick reply.

I am working on Windows and am sorry for not mentioning it before. I would like to know if there is any way by which we can send a mail from the Stored Procedure and invoke this every Monday automatically. Please get back if you are not clear on my requirement.

Thanks and Regards,
Anoop
Reply With Quote
  #5 (permalink)  
Old 12-17-08, 03:25
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by anoopsober
I am working on Windows
Which email software do you have on your system with a non-interactive interface? Do you connect to a POP or IMAP server?
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #6 (permalink)  
Old 12-17-08, 03:40
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
You can write in java / C /C++ / ASP script to send the mail.... other than that i am not 100% sure whether you'll be able to send a mail only with the SQL stored proc...

As for invoking you can use the following scenarios -
[1] Use DB2 Task Center to schedule the job
[2] Write a bat file to invoke the script and schedule the same in schedule task option of windows.
__________________
IBM Certified Database Associate, DB2 9 for LUW
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On