Diff for /loncom/lonsql between versions 1.30 and 1.31

version 1.30, 2001/04/02 20:16:31 version 1.31, 2001/04/11 20:05:29
Line 23  sub wanted { Line 23  sub wanted {
     push(@metalist,"$dir/$_");      push(@metalist,"$dir/$_");
 }  }
   
 {  
     my $dbh;  
     unless (  
     $dbh = DBI->connect("DBI:mysql:loncapa","www","123",{ RaiseError =>0,PrintError=>0})  
     ) {   
  print "Cannot connect to database!\n";  
  exit;  
     }  
     else {  
  $dbh->disconnect;  
     }  
 }  
 $childmaxattempts=10;  $childmaxattempts=10;
 $run =0;#running counter to generate the query-id  $run =0;#running counter to generate the query-id
   
Line 50  while ($configline=<CONFIG>) { Line 38  while ($configline=<CONFIG>) {
 }  }
 close(CONFIG);  close(CONFIG);
   
   # ------------------------------------- Make sure that database can be accessed
   {
       my $dbh;
       unless (
       $dbh = DBI->connect("DBI:mysql:loncapa","www",$perlvar{'lonSqlAccess'},{ RaiseError =>0,PrintError=>0})
       ) { 
    print "Cannot connect to database!\n";
    exit;
       }
       else {
    $dbh->disconnect;
       }
   }
   
 # --------------------------------------------- Check if other instance running  # --------------------------------------------- Check if other instance running
   
 my $pidfile="$perlvar{'lonDaemons'}/logs/lonsql.pid";  my $pidfile="$perlvar{'lonDaemons'}/logs/lonsql.pid";
Line 202  sub make_new_child { Line 204  sub make_new_child {
         #open database handle          #open database handle
  # making dbh global to avoid garbage collector   # making dbh global to avoid garbage collector
  unless (   unless (
  $dbh = DBI->connect("DBI:mysql:loncapa","www","123",{ RaiseError =>0,PrintError=>0})   $dbh = DBI->connect("DBI:mysql:loncapa","www",$perlvar{'lonSqlAccess'},{ RaiseError =>0,PrintError=>0})
  ) {    ) { 
              sleep(10+int(rand(20)));               sleep(10+int(rand(20)));
     &logthis("<font color=blue>WARNING: Couldn't connect to database  ($st secs): $@</font>");      &logthis("<font color=blue>WARNING: Couldn't connect to database  ($st secs): $@</font>");

Removed from v.1.30  
changed lines
  Added in v.1.31


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>