http://www.perlmonks.org?node_id=1223743


in reply to Catch connection error MSSQL

Hi, maybe $@ is getting clobbered somewhere. Try Try::Tiny:

use Try::Tiny; print "Connecting to MSSQL terminology database... "; try { $dbh = DBI->connect("dbi:ODBC:Driver={SQL Server};Server=$SqlDatabase +Name;UID=$SqlDatabaseUser;PWD=$SqlDatabasePassword +", {PrintError => 0, RaiseError => 1, AutoCommit => $AutoCommit, Fetc +hHashKeyName => 'NAME_lc',}) ; $dbh->{'mysql_enable_utf8'} = 1; } catch { print "ERRRRRRRRRRRROR: $_\n"; # error in $_ };

Hope this helps!


The way forward always starts with a minimal test.