-my $dbh = DBI->connect("dbi:SQLite:dbname=$root/data/spider.sdb","","")
- or die "cannot open $root/data/spider.sdb";
+my $dbh;
+my $sort = lc shift || 'sqlite';
+
+if ($sort eq 'sqlite') {
+ unlink "$root/data/spider.db";
+ $dbh = DBI->connect("dbi:SQLite:dbname=$root/data/spider.db","","")
+ or die "cannot open $root/data/spider.db";
+ $dbh->do("PRAGMA default_synchronous = OFF");
+} elsif ($sort eq 'mysql') {
+ $dbh = DBI->connect("dbi:mysql:dbname=spider","spider","spider")
+ or die $DBI::errstr;
+} elsif ($sort eq 'pg') {
+ $dbh = DBI->connect("dbi:Pg:dbname=spider","postgres","")
+ or die $DBI::errstr;
+} else {
+ die "invalid database type: $sort";
+}
+
+$dbh->{PrintError} = 0;
+$dbh->{PrintWarn} = 0;