> -----Original Message-----
> From: louis.bacon / fourshapes.com [mailto:louis.bacon / fourshapes.com]
> Sent: Tuesday, May 26, 2009 6:30 AM
> To: ruby-talk ML
> Subject: DBI Connect failure - can we retry please?
> 
> Hi Guys,
> 
> I got a DBI connection that tries to connect to a source that sometimes
> has an unreliable connection behind it.
> 
>   DBH = DBI.connect('dbi:ODBC:conenction_name', 'username', 'password')
> 
> It has failed a couple of times to connect and just bombs out the
> script. As this is to be an automated script it would be nice to be
> able
> to make a couple of attempts at trying to connect before bombing out.
> 
> Is anyone able to offer any code and advice as to how best to go about
> this? I have looked online but the help is limited.

gem install attempt

attempt{ dbh = DBI.connect(...) }

See http://rubyforge.org/docman/view.php/735/485/README.html for more details.

Regards,

Dan