From 89c0cf9150eaab8f973d8597ec4e6eaf37b71a2f Mon Sep 17 00:00:00 2001 From: MJ Ray Date: Tue, 8 Jan 2008 12:57:23 -0600 Subject: [PATCH] die on db connection failure Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Context.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Context.pm b/C4/Context.pm index c000f340f0..70b199a785 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -597,8 +597,10 @@ sub _new_dbh $db_port = "" unless defined $db_port; my $db_user = $context->config("user"); my $db_passwd = $context->config("pass"); + # MJR added or die here, as we can't work without dbh my $dbh= DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port", - $db_user, $db_passwd); + $db_user, $db_passwd) or die $DBI::errstr; + if ( if ( $db_driver eq 'mysql' ) { # Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config. # this is better than modifying my.cnf (and forcing all communications to be in utf8) -- 2.39.5