or download this
sub open_dbi {
# Declare and initialize variables
...
my $dbh = DBI->connect("dbi:ODBC:database=$db;host=$host", $db_use
+r, $db_password, {RaiseError => 0, PrintError => 0} ) or err_trap("Ca
+nnot connect to the database");
return $dbh;
}