Guest User

Untitled

a guest
Jan 26th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. use DBI;
  2. use Time::Local;
  3. use strict;
  4.  
  5. my $dbh;
  6.  
  7. if(!defined $dbh)
  8. {
  9.  
  10. if ( $dbh = DBI->connect_cached("DBI:mysql:database=DATABASE_NAME:MAIN_DATABASE_IP", "USER", "PASSWORD!", {RaiseError => 0} ) ) {
  11.  
  12. print STDERR "success";
  13.  
  14. } else {
  15.  
  16.  
  17. print STDERR "error: $DBI::errstr\n";
  18.  
  19. if ( $dbh = DBI->connect_cached("DBI:mysql:database=DATABASE_NAME:SECONDARY_DATABASE_IP", "USER", "PASSWORD!") ) {
  20.  
  21. print STDERR "success second db";
  22.  
  23. } else {
  24.  
  25. print STDERR "error: $DBI::errstr\n";
  26.  
  27. }
  28.  
  29. }
  30.  
  31. }
Add Comment
Please, Sign In to add comment