I have made this script that connects to a mySQL database and selects the last row of the table supplied as input.
#!/usr/bin/perl
use DBI;
use Mysql;
$host = '10.47.115.91:3306';
$database = 'ebno_logging';
$user = 'Ebnolog';
$password = 'pw';
$querytable = $ARGV[0];
$querystring = "SELECT * FROM $querytable ORDER BY id DESC LIMIT 1";
$db = Mysql->connect($host, $database, $user, $password);
$query = $db->query($querystring);
@result = $query->fetchrow;
print $result[1];
The script executes pretty much instantly on my windows machine, but when I run it on my server the connection to the database takes almost 20 seconds. The server is running the linux distribution centOS. Anyone know what could cause the long delay when making a connection?
#!/usr/bin/perl
use DBI;
use Mysql;
$host = '10.47.115.91:3306';
$database = 'ebno_logging';
$user = 'Ebnolog';
$password = 'pw';
$querytable = $ARGV[0];
$querystring = "SELECT * FROM $querytable ORDER BY id DESC LIMIT 1";
$db = Mysql->connect($host, $database, $user, $password);
$query = $db->query($querystring);
@result = $query->fetchrow;
print $result[1];
The script executes pretty much instantly on my windows machine, but when I run it on my server the connection to the database takes almost 20 seconds. The server is running the linux distribution centOS. Anyone know what could cause the long delay when making a connection?