Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Catch connection error MSSQL

by 1nickt (Abbot)
on Oct 09, 2018 at 15:15 UTC ( #1223743=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1223743]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2019-12-13 20:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?