[ANN] dbi-dbrc 0.2.0

Hi all,

I’m happy to announce dbi-dbrc 0.2.0

What is it?

This is a supplement to the dbi module, allowing you to avoid
hard-coding
passwords in your programs that make database connections by using a
special config file. It’s also convenient. :slight_smile:

Synopsis:

require 'dbi’
require 'dbi/dbrc’
require ‘timeout’

db = DBI::DBRC.new(“mydb”)

#or

db = DBI::DBRC.new(“mydb”,“someUser”)

n = db.max_reconn

begin
timeout(db.time_out){
begin
DBI.connect(db.dsn,db.user,db.passwd)
rescue
n -= 1
sleep db.interval if n > 0
retry if n > 0
# handle database connection error
end
}
rescue TimeoutError

handle timeout error

end

This module is (or will be, as soon as I upload it via CVS) included as
part of the ruby-dbi package and can be installed using the "-with=dbrc"
option when you install ruby-dbi. I’ve also setup a separate page for
those times when it gets out of sync with the ruby-dbi release and/or
you want to download it separately.

You can find the home page at http://ruby-miscutils.sourceforge.net

Enjoy!

Daniel Berger