Index: branches/pap/DataStoreServer/scripts/dsreg
===================================================================
--- branches/pap/DataStoreServer/scripts/dsreg	(revision 23948)
+++ branches/pap/DataStoreServer/scripts/dsreg	(revision 25027)
@@ -102,7 +102,7 @@
     }
     if (($linkfiles or $copyfiles) and !$datapath and !$abspath) {
-        $err .= "need to specify datapath with --link or --copy\n";
-    }
-    if ($linkfiles && (substr($datapath, 0, 1) ne "/")) {
+        $err .= "need to specify datapath or abspath with --link and --copy\n";
+    }
+    if (!$abspath && $linkfiles && (substr($datapath, 0, 1) ne "/")) {
         $err .= "datapath must begin with / when using --link\n";
     }
@@ -137,12 +137,13 @@
     unless defined stat("$dsroot/$product/index.txt");
 
-$dbname      = metadataLookupStr($siteConfig, 'DBNAME') unless defined $dbname;
-my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
-my $dbuser   = metadataLookupStr($siteConfig, 'DBUSER');
-my $dbpass   = metadataLookupStr($siteConfig, 'DBPASSWORD');
+$dbname      = metadataLookupStr($siteConfig, 'DS_DBNAME') unless defined $dbname;
+my $dbserver = metadataLookupStr($siteConfig, 'DS_DBSERVER');
+my $dbuser   = metadataLookupStr($siteConfig, 'DS_DBUSER');
+my $dbpass   = metadataLookupStr($siteConfig, 'DS_DBPASSWORD');
 exit ($PS_EXIT_CONFIG_ERROR) unless defined $dbserver and $dbname and $dbuser and $dbpass;
 
 my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";
-my %conn_attrs = (PrintError => 1, RaiseError => 1, AutoCommit => 0);
+# mysql cookbook says 'PrintError can interfere with failure detection in some cases'
+my %conn_attrs = (PrintError => 0, RaiseError => 1, AutoCommit => 0);
 
 my $dbh = DBI->connect_cached($dsn, $dbuser, $dbpass, \%conn_attrs)
@@ -211,4 +212,5 @@
     if ($@) { # an error occured
         print STDERR "transaction failed, rolling back error was:\n$@\n";
+        # roll back within eval to prevent rollback failure from terminating the script
         eval {$dbh->rollback();};
         cleanup();
@@ -476,4 +478,5 @@
     --copy      Copy files from datapath to Data Store
     --datapath  path to source files for --copy or --link
+    --abspath   path to source files is absoloute (--datapath not needed)
     --ps0 - ps7 Optional product specific data
     --rm        with --del remove the fileset directory from the Data Store
