Skip to content

Instantly share code, notes, and snippets.

@wwwted wwwted/test_conn.pl
Last active Apr 2, 2019

Embed
What would you like to do?
#!/opt/csw/bin/perl
use DBI;
my $host="192.168.1.233";
my $port="3306";
my $user="ted";
my $pwd="ted";
my $wait;
my @dbhs;
my ($no_cons,$wait) = @ARGV;
if (not defined $no_cons) {
die "Need number of connections to try!\n ./$0 <no of db connectons> [time to sleep]\n";
}
if (not defined $wait) {
$wait=10;
}
foreach my $i (1..$no_cons) {
my $dbh = DBI->connect("dbi:mysql:test;host=$host;port=$port", $user, $pwd);
next unless $dbh;
push @dbhs, $dbh;
}
sleep($wait);
foreach (@dbhs) {
$_->disconnect();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.