Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to send mail from DB2 using the procedure UTL_MAIL. I'm using the DB2 Express Edition 10.1. First I was getting the error of SMTP Server. After using the below command,

update admin cfg using smtp_server LOCALHOST

I am using the following command to send the mail:

CALL UTL_MAIL.SEND('','',NULL,NULL,'Test Email','Test body')

Now I am getting the following error:

SQL1336N The remote host "" was not found. SQLSTATE=08001

I searched a lot and found out that I must CATALOG the server details.

Can anyone please help me regarding this?

share|improve this question localhost your system or is localhost a true SMTP server? Because most of what I see looks like it is looking for an SMTP server. – Chris Aldrich Mar 22 '13 at 12:50 show admin cfg...I think that might be for the DAS. All documentation I see are to update the db cfg (meaning connection to the database you want to send emails from). Try setting that. – Chris Aldrich Mar 22 '13 at 13:39
@ChrisAldrich is correct: For the UTL_MAIL module to work you have to set SMTP_SERVER in the database configuration. – Ian Bjorhovde Mar 22 '13 at 15:23
Thanks @ChrisAldrich for replying. I have the DB2 Express edition. Can you please tell me how to set up the SMTP Server. I'm unable to do it. – Raj Wadhwa Mar 22 '13 at 20:13
can any body tell if this worked out? – user22027 Apr 2 '13 at 7:09

Based on what you are trying to do you would want to set up the STMP server at the database level rather than the DAS level. You set it up at the DAS level if you want DB2 to email alerts to you. See the Information Center here.

You set it up at the database level if you want to use the UTL_MAIL module as you are wishing to use.

You would need to do the following:

db2 connect to mydb -- or whatever your database name is.
db2 update db cfg using smtp_server '<server or ip>:<port>' 
-- you can have a list of smtp servers if you want, just use a comma between them.
db2 connect reset

This setting takes affect immediately. Please see Information Center for more details.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.