in reply to Using DBI to make connection to a database

$DSN= 'dbi:DriverName:database=$db;host=$host;port=$port;'

Have you verified that $DSN contains what you think it should contain?

print "Connecting to [$DSN]\n";

This might help you to find out whether the value of $DSN is what you think it is.