database connection error - alert

When I setup connection to my MySQL database and the connection fails I would like to be able to send out an email notifying the team of such error.

Here is the error I'm getting:

ERROR--test: An error occurred while processing the script: _test db connection
test: The error message was: CommunicationsException (line 4): Communications link failure Last packet sent to the server was 0 ms ago.--Sourced file: inline evaluation of: ``import java.sql.*; Class.forName("com.mysql.jdbc.Driver").newInstance(); Co . . . '' : Typed variable declaration : Method Invocation DriverManager.getConnection

At that point I would like to catch that and execute the mail function.

Thanks,
Jack

That option is only in

That option is only in screen-scraper enterprise edition, and the method is session.sendMail().

Thanks. I downloaded the

Thanks. I downloaded the Enterprise edition but how will I know when to execute the send.Mail method. How to execute that method when the db connection error occurs?