Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2008
    Posts
    3

    Unanswered: 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

  2. #2
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    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

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

  4. #4
    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

  5. #5
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    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/

  6. #6
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •