diff --git a/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm b/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm index f22eed3df6d2a10a5eeef27c12f57a1de98448ad..f752fba9a9a3a45f0d8cce17f5fe7e9240728498 100644 --- a/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm +++ b/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm @@ -179,12 +179,14 @@ sub connect { $dbh = DBI->connect($dsn, $self->username(), $self->password(), - {RaiseError => 1}); + {'RaiseError' => 1}); }; - $dbh || throw("Could not connect to database " . $self->dbname() . - " as user " . $self->username() . - " using [$dsn] as a locator:\n" . $DBI::errstr); + if(!$dbh || $@) { + throw("Could not connect to database " . $self->dbname() . + " as user " . $self->username() . + " using [$dsn] as a locator:\n" . $DBI::errstr); + } $self->db_handle($dbh); @@ -446,7 +448,6 @@ sub prepare { # return an overridden statement handle that provides us with # the means to disconnect inactive statement handles automatically bless $sth, "Bio::EnsEMBL::DBSQL::StatementHandle"; - $sth->dbc($self); return $sth; @@ -516,7 +517,7 @@ sub do { sub disconnect_if_idle { my $self = shift; - if(!$self->db_handle()->{'ActiveKids'} && + if(!$self->db_handle()->{'Kids'} && !$self->db_handle()->{'InactiveDestroy'}) { $self->db_handle->disconnect(); }